Still under construction

Regular Expressions Cheat sheet

An “atom” can be a single character (“f”) or a grouping expression ( “(Mico)( )(Maco)”)

'.'  -   Any character (normally except new line)    

'*'  -   none or many (of the previous "atom")    
'+'  -   one or many (of the previous "atom")    
'?'  -   none or one (of the previous "atom")    

[aeo]  -  Character class: One of the included   ([a-z]a matches "**ha**s", "**la**zy", "**wa**y", etc)    
[^aeo] -  Character class: Not the included      ([^a-z]a matches "**Ma**ry had **a** little lamb.)    
          (includes everything **not** included in the character class)

\b  -   Word boundary  /\PATTERN\b/    
\\< \\> - Exact word boundaries    (need to further investigate diference with \b)    

()  - will create a group that can be "called" by $n (being 'n' from left to rigt, the postion of each open brackets)

GNU GREP options (most useful to Mico Maco…)

-i   -   Case insensitive.    
-E   -   Allows extended expressions. Linux GNU grep (the default grep) is already extended. "-E" only avoids backslashing ?, +, {, |, (, and ).    
-o   -   Print only matching parts of a line (1 output line per match).    
-H   -   Print (prefixed) the filename  (-h cancels file printing. Useful when searching several files).    
-n   -   Print (prefixed) the line number in the input file.    
-w   -   Word boundaries (but will miss \_word\_ !!!)    

-P   -   Use Perl regular expressions (allows lookahead and lookbehind patterns). See [here](

Find palindromes

^(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?)(.?).?\9\8\7\6\5\4\3\2\1$   --> max 19 chars


^(?:[0-9]{1,3}\.){3}[0-9]{1,3}$    --> This admits 999.999.999.999





$url1 = “"; $url2 = “"; $url3 = “"; $url4 = “”; $url5 = “”;

URLs with url parameters –> IP4 Addresses (falla amb ports –> –> URLs (pero admet coses rares com ’s.p’ o ‘[]cenas’) –> Email –> PCRE email validator (algo rar. Es pcre) –> Match brackets (fails when anidated…) –> URLs a (entre “) per a un domnni donat…