Shortcuts
Shortcuts
It allows to specify key characters for simplifying our expressions
\d digits ([0-9])
The expression:
can be easily translated into:
NOTE: we are using -P instead of -E flag because now we are using a Perl regular expression
let’s use this content in your file for tests
\b beginning
Finding expressions beginning with a number:
At the end:
\s space
Finding expressions with spaces:
(?: GROUP )? Optional Group
Let’s validate ZIP codes, valid values are: 5_DIGITS 5_DIGITS-4_DIGITS
For this example we are going to replace the content of the file with:
The expression that we need is:
If you like this post please pay me with a click on the ads :)