php - preg_match dot and slash
314
I would like to add a regular expression character dot.
and such a slash/
.
'numericString' => array(
'pattern' => '^[a-zćęłńóśźżA-Z0-9\s]+$',
)
How i can do?
Answer
Solution:
add
\.
and\/
Answer
Solution:
Note: you must escape the characters "^.[$()|*+?{\" with a backslash ('\'), as they have special meaning.
Use the below code..
Answer
Solution:
A literal
.
is expressed in a regex as\.
A literal
/
is expressed as\/
Note: not all regex flavours require escaping the
/
, only the ones that use it for delimiting the regex.