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

/
/
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)(?<date>(?<=Date:\* ).+?(?=\n))|(?<duration>(?<=Duration:\* ).+?(?= s\n))|(?<callerid>(?<=1: \").+?(?=\" <))|(?<caller>(?<=<).+?(?=>\n2))|(?<dialed>(?<=2: ).+?(?=\n))|(?<confidence>(?<=Confidence:\* ).+?(?=\n))|(?<trans>(?<=TimeDurationSpeakerPhrase\n)((.|\n)*)\n\*DISC)|" & @CRLF & _ "" Local $sString = "Hello," & @CRLF & _ "" & @CRLF & _ "This email contains the transcription of the following call:" & @CRLF & _ "" & @CRLF & _ "*Date:* 2023-01-20 13:15:11" & @CRLF & _ "" & @CRLF & _ "*Duration:* 124 s" & @CRLF & _ "" & @CRLF & _ "*Speakers:*" & @CRLF & _ "1: "[V] RCR MURRIETA CA" <444555444>" & @CRLF & _ "2: 5554443333" & @CRLF & _ "" & @CRLF & _ "*Locale:* en-US" & @CRLF & _ "" & @CRLF & _ "*Confidence:* 84.2%" & @CRLF & _ "Transcription" & @CRLF & _ "TimeDurationSpeakerPhrase" & @CRLF & _ "13:15:11 5 s 2 thank you for calling the rapid clean restoration please" & @CRLF & _ "hold while we connect your call" & @CRLF & _ "13:15:22 14 s 2 no" & @CRLF & _ "13:15:29 2 s 1 i" & @CRLF & _ "13:15:39 0 s 2 Hello." & @CRLF & _ "13:15:42 2 s 1 Uh, hi, is this rapid clean restoration?" & @CRLF & _ "13:15:45 0 s 2 Yes." & @CRLF & _ "13:15:46 5 s 1 hi uhm do you serve i believe you're here in marietta" & @CRLF & _ "correct do you service marietta" & @CRLF & _ "13:15:52 1 s 2 Yes." & @CRLF & _ "13:15:54 6 s 1 OK. I'm just looking for the person who, well, makes" & @CRLF & _ "decisions about community outreach or marketing. Would that be you?" & @CRLF & _ "13:16:00 1 s 2 Uh, yes." & @CRLF & _ "13:16:02 13 s 1 awesome uhm i just wanted to introduce myself i'm a" & @CRLF & _ "publisher and i have a magazine that actually focuses on the west marietta" & @CRLF & _ "community so i believe that's really close to your location um we're" & @CRLF & _ "talking copper canyon bear creek la cresta and a few others" & @CRLF & _ "13:16:16 16 s 1 um and we also pair that up with a digital platform to help" & @CRLF & _ "promote your business in the area and i'm wondering if i could just" & @CRLF & _ "schedule some time with you to review what i do and how the magazine helps" & @CRLF & _ "connect your business with the community do you perhaps have some time" & @CRLF & _ "maybe next week" & @CRLF & _ "13:16:32 7 s 2 uh if i don't leave a lot of time to talk but i want to tell" & @CRLF & _ "you something in an email that has pricing and layouts and stuff like that" & @CRLF & _ "i'll take a look at it" & @CRLF & _ "13:16:41 2 s 1 OK, uh, what's your e-mail?" & @CRLF & _ "13:16:43 3 s 2 Uh, you sent it to Nathan at rapid clean restoration." & @CRLF & _ "13:16:55 0 s 2 Yes." & @CRLF & _ "13:16:56 14 s 1 OK, perfect. Nathan. Um, I'll send you something over. It's" & @CRLF & _ "best to meet or even do a virtual presentation. There's just so many" & @CRLF & _ "options. I can't put that all out into an e-mail, but um, I'll kind of give" & @CRLF & _ "you the basics of where it starts and then, you know, we can certainly work" & @CRLF & _ "from there." & @CRLF & _ "13:17:11 1 s 2 OK. Thank you." & @CRLF & _ "13:17:12 1 s 1 all right thank you nathan bye bye" & @CRLF & _ "" & @CRLF & _ "*DISCOVER OUR FULL RANGE OF BENEFITS*" & @CRLF & _ "" & @CRLF & _ "Bring Your Own" & @CRLF & _ "Device" & @CRLF & _ "" & @CRLF & _ "Contract-Free and Pay-as-You-Go" & @CRLF & _ "" & @CRLF & _ "Exceptional" & @CRLF & _ "Compatibility" & @CRLF & _ "" & @CRLF & _ "Friendly, Available Support Staff" & @CRLF & _ "" & @CRLF & _ "Keep Your Current Number" & @CRLF & _ "" & @CRLF & _ "U.S./Canada" & @CRLF & _ "Enhanced 911" & @CRLF & _ "[image: facebook] <https://www.facebook.com/VoIP.ms/> [image: twitter]" & @CRLF & _ "<https://t.sidekickopen14.com/s3t/c/5/f18dQhb0V1-gmb8cpgc1W14p09m59hl3kW7_k2841CX6NGN36PYBbwdMX6W56JXy755nn4Rf197v5Y04?te=W3R5hFj4cm2zwW4fQ47l4fGCmnW3Fbt5S4kHSlC3b7c2&si=8000000022317663&pi=00185947-b53b-4e80-fbd0-482f43cad100>" & @CRLF & _ "[image:" & @CRLF & _ "linkedin]" & @CRLF & _ "<https://t.sidekickopen14.com/s3t/c/5/f18dQhb0V1-gmb8cpgc1W14p09m59hl3kW7_k2841CX6NGN36PYBbwdMX6W56JXy755nn4Rf197v5Y04?te=W3R5hFj4cm2zwW4mKLS-3ZWVWBW3K2-zv1JxwY5W1Lw3rh45LM6yW1LF-s945l5lZ1V3&si=8000000022317663&pi=00185947-b53b-4e80-fbd0-482f43cad100>" & @CRLF & _ "[image:" & @CRLF & _ "youtube]" & @CRLF & _ "<https://t.sidekickopen14.com/s3t/c/5/f18dQhb0V1-gmb8cpgc1W14p09m59hl3kW7_k2841CX6NGN36PYBbwdMX6W56JXy755nn4Rf197v5Y04?te=W3R5hFj4cm2zwW4mKLS-4rCvX6W4hCVj23Fbt5SW4kHSlC3_ZzS1F3M2m0LS5QQ1&si=8000000022317663&pi=00185947-b53b-4e80-fbd0-482f43cad100>" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "*Note:* Do not reply to this email, you will not receive a response. You" & @CRLF & _ "can contact us regarding this update by sending an email to support@voip.ms." 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