I tried using this which appears to work..
^.*#[0-9]{4}$
test#1234
Except this also is accepted as valid input.
test#1234 #1234
How do I go about making it so that after the 4 digits no other characters will be accepted without hindering the initial match?
Thanks in advance for the help.
I'd use:
$string =~ /^\D+#\d{4}$/
Where \\D
stands for any character that is not a digit.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.