Thursday 15 September 2011

regex - Need a regular expression to count only alphabets without white spaces between the sentence? -



regex - Need a regular expression to count only alphabets without white spaces between the sentence? -

i need set validation number of alphabets in text box without including white space can suggest me regular look

this shot in dark, assuming want allow letters , whitespace in textbox, , total number of letters must not exceed 10, use

^\s*(?:[a-z]\s*){0,10}$

test live on regex101.com.

explanation:

class="lang-none prettyprint-override">^ # start of string \s* # optional whitespace (?: # start of non-capturing group: [a-z] # match single letter (don't forget /i alternative if desired) \s* # optional whitespace ){0,10} # between 0 , 10 times $ # end of string

regex

No comments:

Post a Comment