Regular Expressions 101

Save & Share

  • Regex Version: ver. 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to Community Library

Flavor

  • PCRE2 (PHP >=7.3)
  • PCRE (PHP <7.3)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java 8
  • .NET 7.0 (C#)
  • Rust
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests

Tools

Sponsors
There are currently no sponsors. Become a sponsor today!
An explanation of your regex will be automatically generated as you type.
Detailed match information will be displayed here automatically.
  • All Tokens
  • Common Tokens
  • General Tokens
  • Anchors
  • Meta Sequences
  • Quantifiers
  • Group Constructs
  • Character Classes
  • Flags/Modifiers
  • Substitution
  • A single character of: a, b or c
    [abc]
  • A character except: a, b or c
    [^abc]
  • 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
    .
  • Alternate - match either a or b
    a|b
  • 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
  • Non-capturing group
    (?:...)
  • Capturing group
    (...)
  • Zero or one of a
    a?
  • Zero or more of a
    a*
  • One or more of a
    a+
  • Exactly 3 of a
    a{3}
  • 3 or more of a
    a{3,}
  • Between 3 and 6 of a
    a{3,6}
  • Start of string
    ^
  • End of string
    $
  • A word boundary
    \b
  • Non-word boundary
    \B

Regular Expression
No Match

r"
"
gm

Test String

Code Generator

Generated Code

#include <StringConstants.au3> ; to declare the Constants of StringRegExp #include <Array.au3> ; UDF needed for _ArrayDisplay and _ArrayConcatenate Local $sRegex = "(?m)(^(?P<line_num>[1-9]|1[0-9]|2[0-2])\b +)(?P<qa_type>(Q|A|[mM][rR][\.|:]? [a-zA-Z]+|[mM][rR][sS][\.|:]? [a-zA-Z]+|[mM][sS][\.|:]? [a-zA-Z]+|[mM][iI][sS][sS][\.|:]? [a-zA-Z]+|[dD][rR][\.|:]? [a-zA-Z]+))?([\.|:|\s]+)?(?P<type_text>\b.*)|[pP][aA][gG][eE] (?P<page_num>\d{1,3})" Local $sString = "1 sure I understand, in this figure, the bottom figure" & @CRLF & _ "" & @CRLF & _ "2 below Paragraph 88 that you prepared, to describe" & @CRLF & _ "" & @CRLF & _ "3 your combination of Mendelson '799/Ohsaki, is it" & @CRLF & _ "" & @CRLF & _ "4 intended to show the relative sizes of the various" & @CRLF & _ "" & @CRLF & _ "5 components?" & @CRLF & _ "" & @CRLF & _ "6 MR. SMITH: Objection; form." & @CRLF & _ "" & @CRLF & _ "7 A. No. I'd say it's purely an" & @CRLF & _ "" & @CRLF & _ "8 illustration to convey the concept of how one might" & @CRLF & _ "" & @CRLF & _ "9 combined these elements in order to achieve the" & @CRLF & _ "" & @CRLF & _ "10 benefits we've spoken of, using the convex cover to" & @CRLF & _ "" & @CRLF & _ "11 provide improved adhesion and improved -- I might as" & @CRLF & _ "" & @CRLF & _ "12 well read from the declaration -- "improved adhesion" & @CRLF & _ "" & @CRLF & _ "13 and detection and protection of the elements within."" & @CRLF & _ "" & @CRLF & _ "14 Q. Okay. And if a sensor like the one" & @CRLF & _ "" & @CRLF & _ "15 you showed in the bottom figure below Paragraph 88" & @CRLF & _ "" & @CRLF & _ "16 were used to take a physiological measurement, do you" & @CRLF & _ "" & @CRLF & _ "17 agree that the distribution of incoming light would" & @CRLF & _ "" & @CRLF & _ "18 be different as compared to the same sensor with no" & @CRLF & _ "" & @CRLF & _ "19 cover?" & @CRLF & _ "" & @CRLF & _ "20 MR. SMITH: Objection; form." & @CRLF & _ "" & @CRLF & _ "21 A. Yes, I agree that the convex cover" & @CRLF & _ "" & @CRLF & _ "22 creates refractive effects, which change the angles" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "4/25/2021 [Redacted Text] Vol II" & @CRLF & _ "" & @CRLF & _ "www.[Redacted Text].com [Redacted Text] 2021 [Redacted Text]" & @CRLF & _ "" & @CRLF & _ "Page 275" & @CRLF & _ "" & @CRLF & _ "1 of propagation of the rays of light. We are look at" & @CRLF & _ "" & @CRLF & _ "2 a diffuse light source, so there's many, many" & @CRLF & _ "" & @CRLF & _ "3 different possible rays that could you considered." & @CRLF & _ "" & @CRLF & _ "4 But they all will experience the laws of refraction" & @CRLF & _ "" & @CRLF & _ "5 and that changes the distribution." & @CRLF & _ "" & @CRLF & _ "6 Q. Let me now ask you about Paragraph 20" & @CRLF & _ "" & @CRLF & _ "7 of your report." & @CRLF & _ "" & @CRLF & _ "8 Here, you're discussing the level of" & @CRLF & _ "" & @CRLF & _ "9 ordinary skill in the art, correct?" & @CRLF & _ "" & @CRLF & _ "10 A. That's correct." & @CRLF & _ "" & @CRLF & _ "11 Q. And you refer here -- this is the" & @CRLF & _ "" & @CRLF & _ "12 first sentence. You say, "...a working knowledge of" & @CRLF & _ "" & @CRLF & _ "13 physiological monitoring technologies."" & @CRLF & _ "" & @CRLF & _ "14 Do you see that?" & @CRLF & _ "" & @CRLF & _ "15 A. Yes." & @CRLF & _ "" & @CRLF & _ "16 Q. What did you mean when you said that" & @CRLF & _ "" & @CRLF & _ "17 a person of ordinary skill in the art "would have" & @CRLF & _ "" & @CRLF & _ "18 been someone with a working knowledge of" & @CRLF & _ "" & @CRLF & _ "19 physiological monitoring technologies"?" & @CRLF & _ "" & @CRLF & _ "20 MR. SMITH: Objection; form." & @CRLF & _ "" & @CRLF & _ "21 A. They would have some knowledge of" & @CRLF & _ "" & @CRLF & _ "22 physiological monitoring technologies and would be" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "4/25/2021 [Redacted Text] Vol II" & @CRLF & _ "" & @CRLF & _ "www.[Redacted Text].com [Redacted Text] 2021 [Redacted Text]" & @CRLF & _ "" & @CRLF & _ "Page 276" & @CRLF & _ "15 Ms. Jones: Objection; Maserati are the best!." & @CRLF & _ "16 mr stevENS Loves this!" & @CRLF & _ "17 Dr. doe: Objection; Ferrari are the best!." & @CRLF & _ "4/25/2021 [Redacted Text] Vol II" & @CRLF & _ "" & @CRLF & _ "www.[Redacted Text].com [Redacted Text] 2021 [Redacted Text]" & @CRLF & _ "" & @CRLF & _ "Page 277" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYGLOBALFULLMATCH) Local $aFullArray[0] For $i = 0 To UBound($aArray) -1 _ArrayConcatenate($aFullArray, $aArray[$i]) Next $aArray = $aFullArray ; Present the entire match result _ArrayDisplay($aArray, "Result")

Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for AutoIt, please visit: https://www.autoitscript.com/autoit3/docs/functions/StringRegExp.htm