Librenix  
(Show all Perl articles . . .
)  
Headlines | Linux | Apps | Coding | BSD | Admin | News
Information for Linux System Administration 

Perl One-Liners Explained: Handy Regular Expressions

Up
vote
Down

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:8829 | -pkrumins, November 11, 2011
More Programming articles...

Abstract Art in Tallahassee

coding headlines

No Starch Press has published my Perl One-Liners book!

Tutorial: Create an NFS-like Storage Server with GlusterFS on Ubuntu 12.10

Introduction to Perl one-liners

Using Git for Source Control

Tutorial: Install SVN, Configure multi-protocol access (Ubuntu 11.10)

Debugging Shell Scripts

 

Firefox sidebar

Site map

Site info

News feed

Features

Login
(to post)

Search

 
Articles are owned by their authors.   © 2000-2012 Ray Yeargin