Perl One-Liners Explained: Handy Regular Expressions
|This is the seventh part of a nine-part article on Perl one-liners.|
Perl one-liners are short programs that do one and only one task well and they fit on a single line in the shell.
Perl is not Perl without regular expressions, therefore in this part I come up with and explain various Perl regular expressions. Please see part one for the introduction of the series.
This part explains the following regular expressions:
- Match something that looks like an IP address.
- Test if a number is in range 0-255
- Match an IP address
- Check if the string looks like an email address
- Check if the string is a decimal number
- Check if a word appears twice in the string
- Increase all numbers by one in the string
- Extract HTTP User-Agent string from the HTTP headers
- Match printable ASCII characters
- Match text between two HTML tags
- Replace all bold tags with strong tag
- Extract all matches from a regular expression
| read more | mail this link | score:8683 | -pkrumins, November 11, 2011|
More Programming articles...||