background preloader

Perl

Facebook Twitter

Perl Regular Expressions. Troubleshooters.Com and Code Corner Present Copyright (C) 1998-2001 by Steve Litt Without regular expressions, Perl would be a fast development environment. Probably a little faster than VB for console apps. With the addition of regular expressions, Perl exceeds other RAD environments five to twenty-fold in the hands of an experienced practitioner, on console apps whose problem domains include parsing (and that's a heck of a lot of them). Regular expressions is a HUGE area of knowledge, bordering on an art. Rather than regurgitate the contents of the Perl documentation or the plethora of Perl books at your local bookstore, this page will attempt to give you the 10% of regular expressions you'll use 90% of the time.

Note that for this reason we assume all strings to be single-line strings containing no newline chars. Simple String Comparisons The most basic string comparison is $string =~ m/sought_text/; $string =~ m/^sought_text/; Similarly, the $ operator indicates "end of string". . . Ississ. Perldoc::requick. <div class="noscript"><p><strong>Please note: Many features of this site require JavaScript.

You appear to have JavaScript disabled, or are running a non-JavaScript capable web browser. </strong></p><p> To get the best experience, please enable JavaScript or download a modern web browser such as <a href=" Explorer 8</a>, <a href=" <a href=" or <a href=" Chrome</a>. </p></div> perlrequick - Perl regular expressions quick start This page covers the very basics of understanding, creating and using regular expressions ('regexes') in Perl. Simple word matching The simplest regex is simply a word, or more generally, a string of characters. "Hello World" =~ /World/; # matches Expressions like this are useful in conditionals: print "It matches\n" if "Hello World" =~ /World/; a?

Main ref. <div class="noscript"><p><strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled, or are running a non-JavaScript capable web browser. </strong></p><p> To get the best experience, please enable JavaScript or download a modern web browser such as <a href=" Explorer 8</a>, <a href=" <a href=" or <a href=" Chrome</a>. </p></div> perlre - Perl regular expressions This page describes the syntax of regular expressions in Perl. If you haven't used regular expressions before, a quick-start introduction is available in perlrequick, and a longer tutorial introduction is available in perlretut. Modifiers Matching operations can have various modifiers.

M Treat string as multiple lines. /x # Delete (most) C comments. S/foo/\Ubar/il /l /u. Perl Tutorial Hub. Higher-Order Perl. FAQs. Perl version Preferences <div class="noscript"><p><strong>Please note: Many features of this site require JavaScript. You appear to have JavaScript disabled, or are running a non-JavaScript capable web browser. </strong></p><p> To get the best experience, please enable JavaScript or download a modern web browser such as <a href=" Explorer 8</a>, <a href=" <a href=" or <a href=" Chrome</a>. </p></div>