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 :
Google TipSilent growth in Google's monolopy
Countdown to my first Google Adsense Check
Intelligent Surface from Microsoft
What's Wrong With This Fluid?
5 GHz Overclocking Attempt
Msn Email Address Fetcher (Meaf)
Java Forums
3D Wallpapers
Threading in C#

























































Recent Comments