Reputation: 4607
I'm using <f:validateRegex pattern="[a-zA-Z]*"/>
for ensuring 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.
Upvotes: 5
Views: 31088
Reputation: 1
This worked for me. It includes spaces in text at the start/ end of words.
/^[a-zA-Z ]+$/
Upvotes: -1
Reputation: 490263
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]*"/>
Upvotes: 25