
grep, sed & AWK

while(my $line = <SRC>) {
my $original = $line;
($line = $original) =~ s/^\s*(.*?)\s*$/$1/g;
$line =~ s/^.+alt="([^"]+?)[.,]*".*$/$1/sg;
push @sources, $line;
}
close(SRC);
open(TTS, "< $tts") or die "$!";
{
local $/ = undef;
my $tmp = <TTS>;
@meta = ($tmp =~ m#\[([\d\.]{3,})#g);
}
close(TTS);
var myRe1 = new RegExp("reg(ular)?\s*exp(ression)?");
var myRe2 = /reg(ular)?\s*exp(ression)?/;
if ( url.match("MadJS") ) ...
x(?=y) x(?!y)
Visit now: http://jsperf.com/regexp-test-v-match
myRe = /foo(bar)?baz/i
myRe.test("foobaz") - true
myRe.test("foobar") - true
myRe.test("foobbaz") - false re = /\D(\d+)/g; phone = "call 800-555-1212";re.exec(phone); // [" 800", "800"]re.exec(phone); // ["-555", "555"]re.exec(phone); // ["-1212", "1212"]re.exec(phone); // null
var myRe = /(mad)\s\w+$/i;
"mad, mad world".search(myRe); var content = "case-oriented methods compare cases and consider combinations or conjectures of causal conditions";var re = /(c\w+)\s[^c]\w+/ig;content.match(re);["cases and", "combinations or", "conjectures of"]
rock.replace("Bon Scott", "Brian Johnson");// is really...rock.replace(new RegExp("Bon Scott"), "Brian Johnson");
var rock = "Singers for AC/DC have included BON SCOTT and Brian Johnson.";rock.replace(/(Bon|Brian)\s+(Scott|Johnson)/ig, "Mr. $2");// "Singers for AC/DC have included Mr. SCOTT and Mr. Johnson."var roll = "I enjoy many many kinds of of music.";roll.replace(/(\w+)\s*\1/g, "!$1");// "I enjoy !many kinds !of music.
"Rage Against \n\n The Machine".split(/\s+/)// ["Rage", "Against", "The", "Machine"]"rage against the dying of the light".split(/g\w+/);// ["ra", " a", " the dying of the li", ""]
String.prototype.contains = function(s) { return this.indexOf(s) !== -1; };String.prototype.startsWith = function(s) { return this.indexOf(s) === 0; };String.prototype.endsWith = function(s) { var t = String(s); var index = this.lastIndexOf(t); return index >= 0 && index === this.length - t.length; };
9 sound instances of RegExp.prototype.test3 sound instances of RegExp.prototype.exec11 sound instances of String.prototype.match1 String.prototype.search where String.prototype.indexOf would suffice e.g. if (url.match(/something/))9 String.prototype.match where String.prototype.indexOf would suffice e.g. if (url.match(/something/))10 String.prototype.match where RegExp.prototype.test would suffice e.g. if (url.match(/foo(bar|baz)/i))

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
http://www.bennadel.com/
http://perldoc.perl.org/perlre.html
http://en.wikipedia.org/wiki/Scunthorpe_problem"O'Reilly Regular Expressions"