- Jamie Zawinski / @jwz
Oh hey, these are some notes. They'll be hidden in your presentation, but you can see them if you run the speaker notes server.(emacs / vim / Textmate / Coda / SublimeText)
(AMM / HTML5 Validation)
( a[href$=".pdf"] ) Very loosely based on regular expressions, some modern selectors utilize the leading caret (^) and the trailing dollar sign($).
Great for enhancing markup based on filetypes or on destinations.
( grep / ack / sed )
"string".match( /pattern/ )
preg_match( "/pattern/", "string" );
"string" =~ /pattern/
Regex of DOOM (catches all legal URI’s as specified in RFC’s)
(?:http://(?:(?:(?:(?:(?:a-zA-Z\d[a-zA-Z\d])?).)(?:a-zA-Z[a-zA-Z\d])?))|(?:(?:\d+)(?:.(?:\d+)){3}))(?::(?:\d+))?)(?:/(?:(?:(?:(?:[a-zA-Z\d$-_.+!'(),]|(?:%[a-fA-F\d]{2}))|[;:@&=]))(?:/(?:(?:(?:[a-zA-Z\d$-_.+!'(),]|(?:%[a-fA-F\d]{2}))|[;:@&=]))))(?:\?(?:(?:(?:[a-zA-Z\d$-.+!*'(),]|(?:%[a-fA-F\d]{2}))|[;:@&=])*))?)?)|(?:ftp://(?:(?:(?:(?:(?:[a-zA-Z\d$-.+!'(),]|(?:%[a-fA-F\d]{2}))|[;?&=]))(?::(?:(?:(?:[a-zA-Z\d$-.+!*'(),]|(?:%[a-fA-F\d]{2}))|[;?&=])*))?@)?(?:(?:(?:(?:(?:a-zA-Z\d*[a-zA-Z\d])?).)*(?:a-zA-Z*[a-zA-Z\d])?))|(?:(?:\d+)(?:.(?:\d+)){3}))(?::(?:\d+))?))(?:/(?:(?:(?:(?:[a-zA-Z\d$-.+!'(),]|(?:%[a-fA-F\d]{2}))|[?:@&=]))(?:/(?:(?:(?:[a-zA-Z\d$-.+!*'(),]|(?:%[a-fA-F\d]{2}))|[?:@&=])*))*)(?:;type=[AIDaid])?)?)|(?:news:(?:(?:(?:(?:[a-zA-Z\d$-.+!'(),]|(?:%[a-fA-F\d]{2}))|[;/?:&=])+@(?:(?:(?:(?:a-zA-Z\d[a-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