开发者

Add space character to regular expression pattern [a-zA-Z]*

I'm using <f:validateRegex pattern="[a-zA-Z]*"/> for en开发者_Python百科suring that entered values contain alphabet only, it is working fine but it is not allowing to take space in the string.

How can i incorporate space character in above pattern? Thanks in advance.


Simply add the space to the regex.

<f:validateRegex pattern="[a-zA-Z ]*"/>

If you wanted any whitespace, not just space, swap the space with \s.

<f:validateRegex pattern="[a-zA-Z\\s]*"/>


This worked for me. It includes spaces in text at the start/ end of words.

/^[a-zA-Z ]+$/


I'm used this [a-zA-Z_ ]* its working for me

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜