How to put xpages Regex (First Character and last character) cannot be special character

时间:2017-07-12 07:56:04

标签: javascript xpages xpages-ssjs

currently i only allow can let the field do not allow special character by using this regex : ^[a-zA-Z0-9_ ]*$

If i just want dont let user to pass for first and last character, what should i put on regex?

sample like :

.Apple = fail

Appplepie. = fail

Apple.Pie = pass

1 个答案:

答案 0 :(得分:3)

The following regex should work:

^[a-zA-Z][a-zA-Z0-9._]*[a-zA-Z]$