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 6881867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T05:10:59+00:00 2026-05-27T05:10:59+00:00

For a form validation I’ve to check input with javascript for valid names The

  • 0

For a form validation I’ve to check input with javascript for valid names
The string has to fit the following pattern.

  • I may not start or end with a space
  • It may contain spaces
  • It may contain capital en lowercase letters, inclusive ê è en such
  • It may symbols like – ‘ “
  • It must contain at least 1 character

This RegExp does the job almost:

[a-zA-ZàáâäãåèéêëìíîïòóôöõøùúûüÿýñçčšžÀÁÂÄÃÅÈÉÊËÌÍÎÏÒÓÔÖÕØÙÚÛÜŸÝÑßÇŒÆČŠŽ∂ð ,.'-]

But this RegExp doesn’t check for spaces at start of end.

Which JS RegExp requires the requirements mentioned above?

Thanks in advance

  • 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-05-27T05:11:00+00:00Added an answer on May 27, 2026 at 5:11 am

    Here is my take on the topic:

    if (subject.match(/^(?=\S+)(?=[a-zA-ZàáâäãåèéêëìíîïòóôöõøùúûüÿýñçčšžÀÁÂÄÃÅÈÉÊËÌÍÎÏÒÓÔÖÕØÙÚÛÜŸÝÑßÇŒÆČŠŽ∂ð ,.'-]*$).*(?=\S).$/)) {
        // Successful match
    }
    

    It basically says, start with at least something which isn’t a space. So here goes conditions 1 and 5.

    Then make sure that the whole thing consists of only allowed characters. Here goes all your other conditions.

    Then make sure that there is at least a non space character, match it and then match tne end.

    More details:

    "
    ^                                                                                      # Assert position at the beginning of the string
    (?=                                                                                    # Assert that the regex below can be matched, starting at this position (positive lookahead)
       \S                                                                                     # Match a single character that is a “non-whitespace character”
          +                                                                                      # Between one and unlimited times, as many times as possible, giving back as needed (greedy)
    )
    (?=                                                                                    # Assert that the regex below can be matched, starting at this position (positive lookahead)
       [a-zA-ZàáâäãåèéêëìíîïòóôöõøùúûüÿýñçčšžÀÁÂÄÃÅÈÉÊËÌÍÎÏÒÓÔÖÕØÙÚÛÜŸÝÑßÇŒÆČŠŽ∂ð ,.'-]       # Match a single character present in the list below
                                                                                                 # A character in the range between “a” and “z”
                                                                                                 # A character in the range between “A” and “Z”
                                                                                                 # One of the characters “àáâäãåèéêëìíîïòóôöõøùúûüÿýñçcšžÀÁÂÄÃÅÈÉÊËÌÍÎÏÒÓÔÖÕØÙÚÛÜŸÝÑßÇŒÆCŠŽ?ð ,.”
                                                                                                 # The character “'”
                                                                                                 # The character “-”
          *                                                                                      # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
       $                                                                                      # Assert position at the end of the string (or before the line break at the end of the string, if any)
    )
    .                                                                                      # Match any single character that is not a line break character
       *                                                                                      # Between zero and unlimited times, as many times as possible, giving back as needed (greedy)
    (?=                                                                                    # Assert that the regex below can be matched, starting at this position (positive lookahead)
       \S                                                                                     # Match a single character that is a “non-whitespace character”
    )
    .                                                                                      # Match any single character that is not a line break character
    $                                                                                      # Assert position at the end of the string (or before the line break at the end of the string, if any)
    "
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone experience form validation not working on MVC3? My model is marked up
When doing form validation, I encountered this code: //check each input to ensure it
Form validation for check boxes only seems to be working in IE....? Anyone have
This is a form validation that will hide the submit button if the input
Any recommendations for a javascript form validation library. I could try and roll my
im doing a form validation and I want to validate the input fields when
As part of a form validation in Django, I want to check when a
I am using javascript form validation, and jquery to display the error messaging and
So I want to build a form validation class/object in javascript. The way I
my form validation does not firing...if i try to submit this form without entering

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.