I have string like "ABC 1000", "ABC 1", "ABC 100".
In above string example, first 3 character ie ABC is fixed every time and then digits, digits can be long upto N numbers.
In 2nd part ie after "ABC " it should always be numberic value, no alphabet, no special symbol.
So, how can I manage with regular expression. Please help.
I have tried with following but failed ..
$var="ABC 100";
preg_match("/^INR /[0-9]+/", $var)
You have an extra /
in your regular expression. It should be:
preg_match('/^ABC \d+/', $var);
You could use this:
^[A-Za-z]{3} *\d+$
$var="ABC 100";
preg_match("/^[A-Za-z]{3} *\d+$/", $var)
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.