开发者

regex (preg_match) woes

开发者 https://www.devze.com 2023-03-03 06:36 出处:网络
I\'m sorry if this has been asked before, but I just can\'t get a straight answer from the interwebs today!

I'm sorry if this has been asked before, but I just can't get a straight answer from the interwebs today!

I need to validate a form field and check if there are 3 and only 3 (no more, no less), uppercase letters.

My sorry attempts at regex have so far all failed - I thought tha开发者_StackOverflowt

/^[A-Z]{3}$/

would do the job, but nix. Any takers?!


/^[A-Z]{3}$/ Will check the string for ...

begining_of_the_string->three_and_only_tree_uppercase_letters->end_of_line

no other letters are valid in the string with this regexp.

But, I tried it with js regexp. And I think the same for php. Could you provide full code (or at least part of it) of your php script ?

0

精彩评论

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