How would be the regexp to validate this? xx:xx:xx:xx:xx:xx
each x might be a LOWERCASE a-z or a number. I need also another regexp for UPPERCASE A-Z or a number. in Both cases, there are 6 pairs of xx seperated by :
For the preg_*() functions:
'/[a-z0-9]{2}(:[a-z0-9]{2}){5}/'
Just change the "a-z" to "A-Z" for upper-case, or if either is valid then simply add an "i" modifier after the final "/".
Can you interpret it that I can learn regexp better? For example why the second part is within ()?
I could not understand why "i" identifier? What does it exactly do? Does it validate both lower and uppercase?
"()" are used to specify a sub-pattern, so with the following "{}" they are used to state that the ":[a-z0-9]{2}" pattern is repeated 5 5imes. See PCRE Syntax for more info.
The "i" modifier is the "case-insentitive" modifier. See PCRE Modifiers for more info.