Perl and Regular Expressions
Programming February 26th, 2008
Perl is one of the most rooted scripting languages, and has wide range of libraries for any purpose.Nowadays I’m studying it, and exploring its great usage and ease of use.Perl has powerful string processing ability, and also when you have confidence in using regular expressions, you may achieve anything on parsing.Here I want to demonstrate its simple syntax.
\t : Tab Character
\n : New Line
\r : Carriage Return
\f : Form Feed Character
\cX : Control Character CTRL-X. : Match any one character
| : Alternation
( ) : Group / Also returns the values for $1 , $2 , $3 after proper matches.
[ ] : Define Character class^ : Match the beginning $ : Match the end
\b : Match at a ”word” boundary \B : Match at not a ‘word’ boundary
* : Match 0 or more times
+ : Match at least 1 or more times
? : Match 0 or 1 times
\d : [0-9] A digit \D : A non-digit
\s : Whitespace char \S : A non-whitespace char.
/i : ignore case /g : Match globally (all matches) /s : Substitute, Replace
=~ True If the regex matches !~ True If the regex doesn’t match
The above information will be helpful if you have just started to learn Regular Expressions.
Technorati Tags: Perl, Regex, Regular Expressions, Scripting, Programming, Perl Programming
Some other posts that you may like :
Would open source operating systems be an alternative to Microsoft?Linux and BSD - Why so segregated?
Google Chrome Beta is out ! Download it now
Men vs Women
FileStuff
Scientists claim to have broken speed of light
How a kid can make $900 monthly from Adsense ?
Fujitsu Lifebook T4220 - Convertible Tablet
Getting MX record from DNS
Some useful AES Documentation

























































Recent Comments