Short for regular expression, a regex is a string of text that allows you to create patterns that help match, locate, and manage text. However, its only one of the many places you can find regular expressions. Regular expressions can also be used from the command line and in text editors to find text within a file.
Date Format Pattern ([0-2][0-9]|(3)[0-1])(\/)(((0)[0-9])|((1)[0-2]))(\/)\d{4} 29/05/1453 Mail Pattern ([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4}) muhibrahim.yildirim@stu.fsm.edu.tr Phone Number Pattern [\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6} 05551234567 IP Address Pattern ^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$ 192.168.1.1
Character Classes | |
\w\d\s | word, digit, whitespace |
\W\D\S | not word, digit, whitespace |
[abc] | any of a, b, or c |
[^abc] | not a, b, or c |
[a-g] | character between a & g |
Anchors | |
^abc$ | start / end of the string |
\b\B | word, not-word boundary |
Escaped characters | |
\.\*\\ | escaped special characters |
\t\n\r | tab, linefeed, carriage return |
Groups & Lookaround | |
(abc) | capture group |
(?:abc) | non-capturing group |
Quantifiers & Alternation | |
a*a+a? | 0 or more, 1 or more, 0 or 1 |
a{5}a{2,} | exactly five, two or more |
a{1,3} | between one & three |
ab|cd | match ab or cd |
Ref: Template , Emrah Tema, RegEx Tester * MyRepo Report