Quick RegEx Notes
Quick RegEx Notes
Branching Atoms:-
| use this to branch atoms e.g ((ab)+)|(a+)|(b+)
Specifing Position:-
Specifing Word Boundries:-
\b used to match the start or end of a word. It matches only position
not any character or whitespace
e.g cat\b matches 'cat' at end of word cataaacataacat.
\B To specifically not match at a word boundary
e.g \Bcat\B matches 'cat' not at the start or end of word
cataaacataacat.
For Replacement:-
The complete matched string is represented by $& in some implementations
A portion of found string is represented by \no e.g \1
where the no. represents the n th substring
where $& is not support you can put the regex inside () brackets and the
reference the whole string as \1
Some regex implementations support the use of conversion operations via the
metacharacters listed below
\l Convert next character to lowercase
\u Convert next character to uppercase
\L Convert all characters up to \E to lowercase
\U Convert all characters up to \E to uppercase
\E Terminate \L or \U conversion