. Any single-character wildcard (except \ n)
* Matches the previous content zero or multiple times.
+ Match the preceding content once or multiple times.
? Match the previous content zero or once.
Non-Greedy symbols.
() Mode group
\ 1 reverse (repeated) references the matching text in parentheses.
| Or (select one matching)
[] Character set. Eg: [A-Za-Z], [abcxyz]
^ Except for the delimiters. It is only used in character sets.
\ D Number
\ W word character (number, letter and underline) [a-zA-Z0-9 _]
\ S blank characters (equivalent to [\ f \ t \ n \ r])
\ D non-numeric
\ W non-word
\ S is not blank
The number of occurrences of {} characters. Eg:/a {5, 15}/the letter A appears 5 to 15 times. /(Fred) {3,}/repeated more than 3 times
+? Non-Greedy +
*? Non-Greedy *
.? Non-greedy.
--------------------------------
The boundary anchor of the \ B word is a match of the word (\ W. \ B Non-word boundary position.
^ Match character | ^ the anchor is used to mark the start of a string.
$ Match the character ending with a character | $ the anchor is used to identify the end of a string (including a line break)
--------------------------------
/I case-insensitive
/S any character (used with., which can represent \ n)
/Add spaces to X (spaces and tabs are omitted)
/G Global replacement (replace all matches)
/M multi-line match (line break \ n can be matched)
Eg:/Barney. * Fred/s
/-? \ D + \.? \ D */x
/Barney. * Fred/is both/I and/s
--------------------------------
\ U to uppercase
\ L to lowercase
\ U and \ l will only convert the first character