web blazonry web development scripts and tutorials Get best price on Apple iPhone 11
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   

Perl Home

Perl Scripts
  Count Links
  Mail to MySQL
  ProcLog Files
  Search and Replace
  Site Monitor
  UnTabify

Perl Articles
  csv2htm Converter
  OLE Automation
  Regular Expressions
  SubDir Recursion

Perl Resources
  Regular Expressions Quick Reference
  Regular Expressions Examples
  Recommended Sites
  Bestselling Perl Books
  Free Perl Books (new)
  Free Python Books(new)

Bookmark and Share




Perl: Regular Expressions

Overview of Regular Expressions
A regular expression is a set of characters that determine a pattern or template used to match, or substitute, against a string. Regular expressions were oririnally a UNIX thing, but they now are supported by many text editors, class libraries, scripting tools and IDEs (Interactive Development Environments) including Microsoft Visual C++.

Regular expression is abbreviated as regexp or regex. Plural forms are regexps, regexes, or regexen.

Regular expressions are a powerful way to match strings, much easier than using the 'indexOf' and 'substitute' function found in most programming languages. There are numerous things that can be done with regular expressions, some examples:

  • Find and substitute on any pattern of text
  • Determine if a string is the proper format be it date, decimal, etc...
  • In a list grab all words that begin with A through E
  • Find content between HTML tags
  • Strip all HTML tags

For more detail about regular expressions:

Regular expressions can look and be confusing. I tend to write a test script with just my regexp, just to see if it works properly, and I usually end up rewriting it numerous times. If you want to learn more about Regular Expressions, see the Perl documentation and the links at the bottom of this page.

I do not recommend the book Mastering Regular Expressions, from O'Reilly. I had the first edition. Perhaps the second edition is better. Nonetheless, I found it to be the only bad O'Reilly book I have. It is confusing, and is not written with the idea of explaining how to write working regular expressions that you can use. The book seems to be the “story of regular expressions” and how to implement them on a lower level, such as in a programming language. I learned more about regular expressions from O'Reilly's Learning Perl and Perl Cookbook.


                       

Related Links:

Perl Manual - Regular Expressions
PERL FAQ - Regular Expressions
Steve Litt's PERLs of Wisdom : RegExps

gnu.regexp package for Java

String Matching and Replacing in JavaScript 1.2 — someone's local copy of an article that was in the now defunct Netscape DevEdge

 

Newest Pages
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2016. astonishinc.com   All Rights Reserved.