Power Text search and replace

 

In computing, a regular expression is a string that is used to describe or match a set of strings, according to certain syntax rules. For example, the regular expression \bex can be used to describe (and search for) all of the instances of the string “ex” that occur at word breaks (signified by the \b). Thus in the phrase, “Texts for expert experimenters,” the regular expresssion \bex returens the “ex” in “expert” and “experimenters,” but not in “Texts” (because the “ex” occurs inside the word there and not at the word break). Regular expressions are used by many text editors and utilities to search and manipulate bodies of text based on certain patterns. Many programming languages support regular expressions for string manipulation. For example, Perl and Tcl have a powerful regular expression engine built directly into their syntax. The set of utilities (including the editor ed and the filter grep) provided by Unix distributions were the first to popularize the concept of regular expressions. “Regular expression” is often shortened in speech to regex, and in writing to regexp or regex (singular) or regexps, regexes, or regexen (plural).

 

Many modern computing systems provide wildcard characters in matching filenames from a file system. This is a core capability of many command-line shells and is known as globbing. Wildcards differ from regular expressions in that they can only express very restrictive forms of alternation.

 

source: Wikipedia:Regular_expression

 

 

Pronunciation

You know, “regexp” is just plain stupid, and unpronouncable. “Regex” is so much easier.

 

Wayne hits the nail on the head - except for the whole “soft ‘g’” thing.

 

 

Resources

Regular Expression Tutorial from Jan Goyvaerts aka http://www.regular-expressions.info - IMHO, this is the best of the bunch

 

Regular Expressions Tutorial from http://weblogtoolscollection.com
http://www.night-ray.com/regex.pdf

 

O’Reilly: Five Habits for Successful Regular Expressions: comments, tests, etc.

 

^txt2regex$: Regular Expression Tool To Create Regex from Description -- Unix tool; haven’t used it (here for future reference). I’m usually suspicious of these natural-language→regex parsers. There’s something similar in Emacs that I also avoid.

 

IBM’s Essential aids in building and testing regular expressions (on UNIX systems) -- Grep? and Emacs, mostly.

 

http://web.ics.purdue.edu/~yoder2/hints/installs/emacs-regexp.txt
http://bc.tech.coop/blog/071103.html
http://regex.info/
Regex Coach
Regulazy

 

Steven Levithan: Top 10 reasons to learn and use Regular Expressions

 

Coding Horror: intro and why to use them
Stack Overflow: why a regex is bad for parsing regexes
Stack Overflow: unit-testing regexes

 

free online regex tester(approve sites) - uses ActionScript 3 - so it s/b identical to the JS flavor

 

 

Common pitfalls

Catastrophic backtracking
dot over-use
not for html oh no not for html
Death to Dot Star - the answer that’s blowing in the wind? negated character-classes, my friend.

 

 

Testing

http://ola-bini.blogspot.com/2008/06/testing-regular-expressions.html

 

 

See Also

Emacs.RegularExpressions for issues with Emacs RegExes
VisualBasic.VbRegexp
VisualStudio#RegEx for issues with, er, VisualStudio RegExes
Jan Goyvaerts - SO profile of Regex Buddy author

 

 

Category tags

RegEx Programming RegExp Text


 

Comments

No comments yet.

 

 

Add Comment

Heading:
 Your Message
 
 Enter value ← Have you entered the code number?
Author: