=~
Gives the index of the first match[]
return the first matchgsub
FIND MEsplit
FIND MEscan
Returns an array of matches
/P/
A character, anywhere in the string/PM/
Two characters next to each other/M+/
One or more of its target/M*/
Zero or more of its target/./
match any character
[abc]
A single character of: a, b, or c[^abc]
Any single character except: a, b, or c[a-z]
Any single character in the range a-z[a-zA-Z]
Any single character in the range a-z or A-Z^
Start of line$
End of line\A
Start of string\z
End of string\s
Any whitespace character\S
Any non-whitespace character\d
Any digit\D
Any non-digit\w
Any word character (letter, number, underscore)\W
Any non-word character\b
Any word boundary(...)
Capture everything enclosed(a|b)
a or ba?
Zero or one of aa*
Zero or more of aa+
One or more of aa{3}
Exactly 3 of aa{3,}
3 or more of aa{3,6}
Between 3 and 6 of a
- does case matter?
- can we get rid of the plus in scan?
END $ curl -i google.com HTTP/1.1 301 Moved Permanently Location: http://www.google.com/ Content-Type: text/html; charset=UTF-8 Date: Thu, 07 Jan 2016 16:49:09 GMT Expires: Sat, 06 Feb 2016 16:49:09 GMT Cache-Control: public, max-age=2592000 Server: gws Content-Length: 219 X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN
<TITLE>301 Moved</TITLE> The document has moved here.