computing:regex
Differences
This shows you the differences between two versions of the page.
| computing:regex [2023/09/04 13:28] – created oscar | computing:regex [2026/12/01 04:00] (current) – removed - external edit (Unknown date) 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| - | ====== Regex ====== | ||
| - | |||
| - | ---- | ||
| - | |||
| - | === Characters === | ||
| - | |\d |one digit from 0 to 9| | ||
| - | |\w |word character: ASCII letter, digit or underscore| | ||
| - | |\s |whitespace character: space, tab, newline, carriage return, vertical tab| | ||
| - | |\D |One character that is not a digit| | ||
| - | |\W |One character that is not a word character )| | ||
| - | |\S |One character that is not a whitespace character | | ||
| - | |\metachar |Escape a metacharacter " | ||
| - | |\t |Tab| | ||
| - | |\r |Carriage return character| | ||
| - | |\n |Line feed character| | ||
| - | |\r\n |Line separator| | ||
| - | |||
| - | === Quantifiers === | ||
| - | |a? |Zero or one of a| | ||
| - | |a* |Zero or more of a| | ||
| - | |a+ |One or more of a| | ||
| - | |[0-9]+ |One or more of 0-9| | ||
| - | |a{3} |Exactly 3 of a| | ||
| - | |a{3,} |3 or more of a| | ||
| - | |a{3,6} |Between 3 and 6 of a| | ||
| - | |a* |Greedy quantifier| | ||
| - | |a*? |Lazy quantifier| | ||
| - | |a*+ |Possessive quantifier| | ||
| - | |||
| - | === Character Classes === | ||
| - | |[abc] |A single character of: a, b or c| | ||
| - | |[%%^%%abc] |A character except: a, b or c| | ||
| - | |[a-z] |A character in the range: a-z| | ||
| - | |[%%^%%a-z] |A character not in the range: a-z| | ||
| - | |[0-9] |A digit in the range: 0-9| | ||
| - | |[a-zA-Z] |A character in the range: a-z or A-Z| | ||
| - | |[a-zA-Z0-9] |A character in the range: a-z, A-Z or 0-9| | ||
| - | |[\x41] |A character at hex position 41 in the ASCII table, i.e. A| | ||
| - | |||
| - | === Anchors === | ||
| - | |%%^%% |Start of string| | ||
| - | |$ |End of string| | ||
| - | |\A |Start of string| | ||
| - | |\Z |End of string| | ||
| - | |\z |Absolute end of string| | ||
| - | |\b |A word boundary| | ||
| - | |\B |Non-word boundary| | ||
| - | |\G |Start of match| | ||
| - | |||
| - | === Group Constructs === | ||
| - | |(...) |Capturing group: Match everything enclosed| | ||
| - | |(a%%|%%b) |Capturing group: Match either a or b| | ||
| - | |(? | ||
| - | |(?:...) |Non-capturing group: Matches and does not remember the match| | ||
| - | |(?>...) |Atomic group (non-capturing)| | ||
| - | |(? | ||
| - | |||
| - | === Lookarounds === | ||
| - | |(?=...) |Positive Lookahead. x(? | ||
| - | |(?!...) |Negative Lookahead. x(?!y) Matches " | ||
| - | |(? | ||
| - | |(? | ||
| - | |||
| - | ==== Cheat sheets ==== | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | ==== Online Testers ==== | ||
| - | * [[https:// | ||
| - | * [[https:// | ||
| - | |||
| - | ==== Links ==== | ||
| - | * [[http:// | ||
computing/regex.1693834101.txt.gz · Last modified: by oscar
