Difference between revisions of "Regular Expressions"

From wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
|.||Any character except newline
+
|.||Any character except newline||\c||Control character
 
|-
 
|-
|\d||Digit
+
|\d||Digit||\D||non Digit
 
|-
 
|-
|\s||Whitespace
+
|\s||Whitespace||\S||non Whitespace
 +
|-
 +
|\w||Word character [A-Za-z0-9]||\W||non Word character
 +
|-
 +
|^||Start of string||$||End of string
 
|-
 
|-
 
|*||0 or more matches of previous expression
 
|*||0 or more matches of previous expression
 
|-
 
|-
|+||1 or more matches of previous expression
+
|<nowiki>+</nowiki>||1 or more matches of previous expression
 +
|-
 +
|<nowiki>?</nowiki>||0 or 1 matches (optional). Stop search
 +
as soon as next expression is found (non greedy)
 
|}
 
|}

Revision as of 23:02, 17 January 2018

. Any character except newline \c Control character
\d Digit \D non Digit
\s Whitespace \S non Whitespace
\w Word character [A-Za-z0-9] \W non Word character
^ Start of string $ End of string
* 0 or more matches of previous expression
+ 1 or more matches of previous expression
? 0 or 1 matches (optional). Stop search

as soon as next expression is found (non greedy)