Rob van der Woude's Scripting Pages


Sponsored link:
Windows grep software to search (and replace) through files and folders on your PC and network
Windows grep software to search (and replace) through files and folders on your PC and network


Regular Expressions

Regular expressions are the core element of utilities like egrep (UNIX) and findstr (Windows NT), and of the Perl programming language.
They are available in many other programming languages too.
They are an extremely powerful mechanism for searching or manipulating text.
For example, compare the use of FIND and FINDSTR to find a date in a text string. Both are used to search "literal" strings within strings, most of the time.
I wouldn't know how to search for any (unknown) date with a FIND command (though it can be done using FOR /F), but FINDSTR's (limited) regular expressions extensions make it possible.


Getting Started

Read a book on regular expressions, a wide choice of titles has become available recently.
Personally I loved reading Mastering Regular Expressions, Second Edition by Jeffrey E.F. Friedl. A great book to really start mastering regular expressions.
Or if you want a quick start, try Ben Forta's Sams Teach Yourself Regular Expressions in 10 Minutes.

Nothing beats practice.

Download any of the Regular Expression Builder or Evaluator tools available and start playing.
Test my sample expressions.
Try to match all HTML tags in a file, or all outward links, or whatever you like.


Jan Goyvaerts' Regular Expressions Info pages.

ActiveState Programmer Network's Rx Cookbook

A list of tools for building and testing regular expressions. articles Regexp Power and Power Regexps, Part II by Simon Cozens, June 06 / July 01, 2003.

Regular Expressions for client-side JavaScript reference by VisiBone.

Well House Consultants' Regular Expressions Home Page has neat lists of regular expression elements sorted by programming language.

page last modified: 2016-09-19