RegExp, also known as regex or Regular Expressions, is a specialised string which can “match” text, and can also do a more advanced “search and replace” than normal string matching. It uses characters with special meaning to allow very flexible matching of strings.
abc will find any “abc” in text, like: aksjabcskabbcldga, abcasfreabababcacas
ab*c will find a letter ‘a’, followed by zero or more letters ‘b’ and one letter ‘c’, like these: fdkhjaclsdabcsldkabbbbbbbcksdd
a[bde]c will find a letter ‘a’, followed by ‘b’ or ‘d’ or ‘e’, followed by ‘c’, like: skdjacacabcaabbccadcandaecacasce
a[bde]*c will find a letter ‘a’, followed by zero or more letters ‘b’ or ‘d’ or ‘e’, followed by ‘c’, like these: asdljacandaaabdebdbbdecoppabbbbcbutalsoadcandsoon
It can be more complicated and may also act as a “search and replace”. Look:
s/\([^,]*\), \([^,]*\)/\2 \1/ (using default syntax of Vim and sed) - In a file with each line containing a name in form “Smith, John”, this RegExp, when applied to each line, converts the names to “John Smith” form.
See the Wikipedia page for a more thorough description.
Windows only -> To learn how to use regular expressions interactively, use the wonderful regular expression coach.
Linux only -> You may also try the ^txt2regex$, which is a Regular Expression “wizard”, all written with bash2 builtins, that converts human sentences to RegExps.
Opera (in M2 filters and in JavaScript scripts)
Vim, a very powerful but a bit difficult to learn text editor (multi-systems)
ReplaceEm (Windows)
Lots of Unix/Linux utilities (sed, awk, locate, grep, egrep…)
In your "Free software with support to RegExp" section, you should add:
- Notepad (best Windows text editor, IMHO)
- MP3BookHelper (MP3 ID3 tag editor)
199.19.145.230 (2011-02-23 16:47:32)
THX that's a great anwesr!
84.73.125.222 (2011-04-21 11:01:35)
H9vn35 Hello! How do you feel about young composers?!....
193.105.210.170 (2012-02-11 13:30:45)
Thanks for the mini RegExp tutorial CrazyTerabyte! :) I'll add the RegExp Coach above which is an excellent way for users to learn regular expressions interactively.
NonTroppo (2003-10-27 10:01:34)