Regex in asp.net for allowing only characters with single space?

RachitSharma

I want to allow a user to enter only characters and with single space in a textbox. What i have tried is :

^[\w\.:\(\)\[\]{}\-_](?: ?[\w\.:\(\)\[\]{}\-_])*$

it is blocking all but allowing digits also . How to make it correct such that it only allow characters and no digits but a single space between words? Thank you.

Toto

I'd use:

^[\p{L}.:()[\]{}_-]+(?: [\p{L}.:()[\]{}_-]+)*$

Where \p{L} stands for any letter.

Edit:
I've changed \pL to \p{L} because it's not supported by .NET.
Thanks to Alan Moore.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

regex for allowing only certain special characters and also including the alphanumerical characters

Regular Expression to validate empty fields allowing space with characters only

Javascript - Regex for allowing only selected special characters only

Regex validation Allow only Character and space in Asp.net

Regex for allowing alphanumeric,-,_ and space

Regex for allowing alphanumeric and space

Regex for only allowing letters, numbers, space, commas, periods?

Gave regex for allowing only alphabets and a space but its not validating for numpad

Regex Pattern for not allowing slash on beginning and ending and not allowing special characters except slash, underscore, space

regex for not allowing <> special characters

Regex allowing and disallowing characters

Only allowing certain characters

Regex allowing a space character in Java

Regex not allowing certain special characters

JS Regex allowing incorrect characters

Regex to replace all leading tab characters, each one with a single space

Regex - Validate that the local part of the email is not ending with a dot while only allowing certain characters without using a lookbehind

regex for only whitespace alone, not white-space in between characters?

regex to allow only alphabets and no special characters, with no space at the beginning

Regex for allowing Hindi Characters along with English in PHP

regex for allowing alphanumeric, special characters and not ending with @ or _ or

Only allowing Uppercase characters in a text box

Allowing only alphanumeric characters in a form textbox with Bootstrap?

Remove spaces between characters in cell, but only if the space exists between two single characters

RegEx validation for only empty space; should accept space between words/characters

regex to disallow space at begining and end and allow only one space between characters

Remove space delimited single characters

Regular Expression for not allowing 'Space in start and ending of string' and Special Characters in a string?

Regex match 4 to 60 characters, space, single quote and exclude trailing spaces

TOP Ranking

HotTag

Archive