Changes

Jump to navigation Jump to search
2,274 bytes added ,  13:45, 12 February 2020
m
Line 1: Line 1:  +
==Quick Reference==
 +
 +
===All===
 +
{| class="wikitable"
 +
|+
 +
https://regex101.com/
 +
!Token
 +
!Description
 +
|-
 +
|Newline
 +
|\n
 +
|-
 +
|Carriage return
 +
|\r
 +
|-
 +
|Null character
 +
|\0
 +
|-
 +
|A single character of: a, b, or c
 +
|[abc]
 +
|-
 +
|A character except: a, b, c
 +
|[^a,b,c]
 +
|-
 +
|A character in the range a-z
 +
|[a-z]
 +
|-
 +
|A character not in the range a-z
 +
|[^a-z]
 +
|-
 +
|A character in the range a-z or A-Z
 +
|[a-zA-Z]
 +
|-
 +
|Any single character
 +
|.
 +
|-
 +
|Any whitespace character
 +
|\s
 +
|-
 +
|Any non-whitespace character
 +
|\S
 +
|-
 +
|any digit
 +
|\d
 +
|-
 +
|Any non-digit
 +
|\D
 +
|-
 +
|Any word character
 +
|\w
 +
|-
 +
|Any non-word character
 +
|\W
 +
|-
 +
|Vertical whitespace character
 +
|\v
 +
|-
 +
|Match nth subpattern
 +
|\n
 +
|-
 +
|Hex character YY
 +
|\xYY
 +
|-
 +
|Octal character ddd
 +
|\ddd
 +
|-
 +
|Backspace character
 +
|[\b]
 +
|-
 +
|Makes any character literal
 +
|\
 +
|-
 +
|Capture everything enclosed
 +
|(...)
 +
|-
 +
|Match either a or b
 +
|<nowiki>(a|b)</nowiki>
 +
|-
 +
|Match everything enclosed
 +
|(?:...)
 +
|-
 +
|Comment
 +
|(?#...)
 +
|-
 +
|Named Capturing Group
 +
|(?P<name>...)
 +
|-
 +
|Inline modifiers
 +
|(?imsxXU)
 +
|-
 +
|Conditional statement
 +
|<nowiki>(?(1)yes|no)</nowiki>
 +
|-
 +
|Match subpattern `name`
 +
|(?P=name)
 +
|-
 +
|Positive Lookahead
 +
|(?=...)
 +
|-
 +
|Negative Lookahead
 +
|(?!...)
 +
|-
 +
|Positive Lookbehind
 +
|(?<...)
 +
|-
 +
|Negative Lookbehind
 +
|(?<!...)
 +
|-
 +
|Zero or one of a
 +
|a?
 +
|-
 +
|Zero or more of a
 +
|a*
 +
|-
 +
|One or more of a
 +
|a+
 +
|-
 +
|Exatly 3 of a
 +
|a{3}
 +
|-
 +
|Between 3 and 6 of a
 +
|a{3, 6}
 +
|-
 +
|Greedy quantifier
 +
|a*
 +
|-
 +
|Lazy quantifier
 +
|a*?
 +
|-
 +
|Start of string
 +
|^
 +
|-
 +
|End of string
 +
|$
 +
|-
 +
|Start of string
 +
|\A
 +
|-
 +
|End of string
 +
|\Z
 +
|-
 +
|A word boundary
 +
|\b
 +
|-
 +
|A word boundary with postgres
 +
|\y
 +
|-
 +
|A non word boundary
 +
|\b
 +
|-
 +
|A non word boundary with postgres
 +
|\Y
 +
|-
 +
|Global
 +
|g
 +
|-
 +
|Multiline
 +
|m
 +
|-
 +
|Case insensitive
 +
|i
 +
|-
 +
|Ignore whitespace
 +
|x
 +
|-
 +
|Single line
 +
|s
 +
|-
 +
|Enable unicode support
 +
|u
 +
|-
 +
|Restrict matches to ASCII only
 +
|a
 +
|-
 +
|Complete match contents
 +
|\g<0>
 +
|-
 +
|Complete match contents
 +
|\0
 +
|-
 +
|Contents in capture group 1
 +
|\1
 +
|-
 +
|Contents in capture group 1
 +
|$1
 +
|-
 +
|Contents in capture group `foo`
 +
|${foo}
 +
|-
 +
|Hexadecimal replacement values
 +
|\x20
 +
|-
 +
|Hexadecimal replacement values
 +
|\x{06fa}
 +
|-
 +
|Tab
 +
|\t
 +
|-
 +
|Carriage return
 +
|\r
 +
|-
 +
|Newline
 +
|\n
 +
|-
 +
|Form-feed
 +
|\f
 +
|-
 +
|Uppercase Transformation
 +
|\U
 +
|-
 +
|Lowercase Transformation
 +
|\L
 +
|-
 +
|Terminate any Transformation
 +
|\E
 +
|-
 +
|3 or more of a
 +
|a{3,}
 +
|}
 +
 +
==Examples==
 +
 
===Port===
 
===Port===
 
<source lang="python">port_regex = re.compile(r'\b('
 
<source lang="python">port_regex = re.compile(r'\b('

Navigation menu