开发者

Regex to allow apostrophe only for words ending with s

开发者 https://www.devze.com 2023-03-24 00:36 出处:网络
I\'m using this Regex ^[a-zA-Z0-9]{2,20}$ to allow the followi开发者_如何学编程ng rules: - Letters a-z

I'm using this Regex ^[a-zA-Z0-9]{2,20}$ to allow the followi开发者_如何学编程ng rules: - Letters a-z - Letters A-Z - Numbers 0-9 - Input length must be at least 2 characters and maximum 20 characters.

I also want to allow apostrophe only at the end of words ending with s.

Thanks,


^([a-zA-Z0-9]{2,20}|[a-zA-Z0-9]{2,18}'s)$

So: either your original regex, or your original regex (reduced to maximum 18 characters, you might want to change the minimum as well) ending in "'s".

0

精彩评论

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

关注公众号