Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7742817
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T09:22:24+00:00 2026-06-01T09:22:24+00:00

SO buddies, greetings. I have some password requirements I need to implement and one

  • 0

SO buddies, greetings. I have some password requirements I need to implement and one of the requirements is the string cannot start or end with a special character. I did spend some time Googling around but my RegEx kung-fu is kimosabe level.

Just in case you’re interested in some code, here’s the JavaScript:
Note: Yes, passwords are also validated on the server as well 🙂 The following snippet runs the RegEx tests and simply checks or x’s the row item associated with the password rule.

var validate = function(password){
        valid = true;

        var validation = [
            RegExp(/[a-z]/).test(password), RegExp(/[A-Z]/).test(password), RegExp(/\d/).test(password), 
            RegExp(/[-!#$%^&*()_+|~=`{}\[\]:";'<>?,./]/).test(password), !RegExp(/\s/).test(password), !RegExp("12345678").test(password), 
            !RegExp($('#txtUsername').val()).test(password), !RegExp("cisco").test(password), 
            !RegExp(/([a-z]|[0-9])\1\1\1/).test(password), (password.length > 7)
        ]

        $.each(validation, function(i){
            if(this == true)
                $('.form table tr').eq(i+1).attr('class', 'check');
            else{
                $('.form table tr').eq(i+1).attr('class', '');
                valid = false
            }
        });

        return(valid);

    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T09:22:25+00:00Added an answer on June 1, 2026 at 9:22 am

    EDIT: The regular expression you want is:-

    /^[a-zA-Z0-9](.*[a-zA-Z0-9])?$/
    

    Additional information

    In regular expressions ^ means ‘beginning of string’ and $ means ‘end of string’, so for example:-

    /^something$/
    

    Matches

    'something'
    

    But not

    'This is a string containing something and some other stuff'
    

    You can negate characters using [^-char to negate-], so

    /^[^#&].*/
    

    Matches any string that doesn’t begin with a # or a &

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I and some buddies have an argument here - in which langauge is it
I and some buddies have an argument here - in which langauge is it
I have some event handlers that work in FF and not in Safari. Simply
For my iphone game i need to implement a notification service from the server.
I have a need to send a message to a number of people to
public class Buddy { public string[] Sayings; } Buddy one = new Buddy(); one.Sayings
So a lot of my programmer buddies have urged me to switch from (g)vim
I have a ListBox with a list of Buddies bound to the class Buddy
Well, thats it! I need to convert a string text (likeHrd$457), into a long
Hej Buddies! I'm trying to create a mock for an interface like the one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.