What you can do with regular expressions
Sometimes, people do not know what they can do with regular expressions. The syntax may be known, but the applications still appear unrecognized. This is the reason why I decided to list a few typical cases with the regular expressions to search for and their meanings.
- MS-DOS file names
- Regex pattern: \([A-Za-z]\:\)\([A-Za-z]+\)\.\([A-Za-z]+\)
- Search into: C:file.txt
- expr1 = drive (C:)
- expr2 = file name (file)
- expr3 = file suffix (txt)
- HTTP (web) address
- Regex pattern: https://\([a-z]+\..+\.[a-z]+\)/\([a-z/]*\)\//([a-z]+.[a-z]+/)
- Search into: https://www.ser.com/dir/file.htm
- expr1 = server name (www.ser.com)
- expr2 = directory name (dir)
- expr3 = file name (file.htm)
Regular expressions can also be used to “decode” email SMTP headers, compilation errors in a compilation error file, etc.