PHP Regular Expressions Using +, *, And ? – String Function
Regexp Result preg_match("/[A-Z]+/", "123") False preg_match("/[A-Z][A-Z0-9]+/i", "A123") True preg_match("/[0-9]?[A-Z]+/", "10GreenBottles") True; matches "0G" preg_match("/[0-9]?[A-Z0-9]*/i", "10GreenBottles") True preg_match("/[A-Z]?[A-Z]?[A-Z]*/", "") True; zero or one match, then zero or one match, then zero or more means that an empty string matches
Filed Under: Php Basics Examples