Regular Expressions 101

Save & Manage Regex

  • Current Version: 1
  • Save & Share
  • Community Library

Flavor

  • PCRE2 (PHP)
  • ECMAScript (JavaScript)
  • Python
  • Golang
  • Java
  • .NET 7.0 (C#)
  • Rust
  • PCRE (Legacy)
  • Regex Flavor Guide

Function

  • Match
  • Substitution
  • List
  • Unit Tests
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
Processing...

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)(?<=[\,\"])[^\,\"]+\[[A-Z]{2}\]" Local $sString = "{"state": "AL", "year": 2020, "events": [{"phenomena": "SV", "significance": "A", "eventid": 34, "hvtec_nwsli": null, "area": 20747.0, "locations": "Franklin [AL], Limestone [AL], Colbert [AL], Jackson [AL], Madison [AL], DeKalb [AL], Lawrence [AL], Lauderdale [AL], Morgan [AL], Cullman [AL], Marshall [AL]", "issue": "2020-02-12T22:34:00Z", "product_issue": "2020-02-12T22:34:00Z", "expire": "2020-02-13T03:27:00Z", "init_expire": "2020-02-13T06:00:00Z", "uri": "/vtec/#2020-O-NEW-KHUN-SV-A-0034", "wfo": "HUN"}, {"phenomena": "SV", "significance": "A", "eventid": 34, "hvtec_nwsli": null, "area": 33422.0, "locations": "Tuscaloosa [AL], Greene [AL], Bibb [AL], Shelby [AL], Sumter [AL], Winston [AL], Cherokee [AL], Lamar [AL], Blount [AL], Etowah [AL], Walker [AL], Fayette [AL], St. Clair [AL], Marion [AL], Jefferson [AL], Pickens [AL], Hale [AL]", "issue": "2020-02-12T22:35:00Z", "product_issue": "2020-02-12T22:35:00Z", "expire": "2020-02-13T03:02:00Z", "init_expire": "2020-02-13T06:00:00Z", "uri": "/vtec/#2020-O-NEW-KBMX-SV-A-0034", "wfo": "BMX"}, {"phenomena": "SV", "significance": "A", "eventid": 41, "hvtec_nwsli": null, "area": 28974.0, "locations": "Pike [AL], Elmore [AL], Dallas [AL], Bullock [AL], Montgomery [AL], Perry [AL], Autauga [AL], Marengo [AL], Barbour [AL], Lowndes [AL], Sumter [AL], Macon [AL], Greene [AL], Hale [AL], Russell [AL]", "issue": "2020-03-04T08:39:00Z", "product_issue": "2020-03-04T08:39:00Z", "expire": "2020-03-04T14:29:00Z", "init_expire": "2020-03-04T16:00:00Z", "uri": "/vtec/#2020-O-NEW-KBMX-SV-A-0041", "wfo": "BMX"}, {"phenomena": "SV", "significance": "A", "eventid": 45, "hvtec_nwsli": null, "area": 26481.0, "locations": "Tuscaloosa [AL], Hale [AL], Walker [AL], Fayette [AL], Winston [AL], Lamar [AL], Perry [AL], Bibb [AL], Pickens [AL], Greene [AL], Marengo [AL], Marion [AL], Sumter [AL]", "issue": "2020-03-11T17:26:00Z", "product_issue": "2020-03-11T17:26:00Z", "expire": "2020-03-11T22:42:00Z", "init_expire": "2020-03-12T00:00:00Z", "uri": "/vtec/#2020-O-NEW-KBMX-SV-A-0045", "wfo": "BMX"}, {"phenomena": "SV", "significance": "A", "eventid": 88, "hvtec_nwsli": null, "area": 55154.0, "locations": "Bibb [AL], Dallas [AL], Randolph [AL], Shelby [AL], Greene [AL], Pickens [AL], Montgomery [AL], Elmore [AL], Russell [AL], Tallapoosa [AL], Perry [AL], Chambers [AL], Clay [AL], Lowndes [AL], Sumter [AL], Macon [AL], Talladega [AL], Chilton [AL], Coosa [AL], Lee [AL], Pike [AL], Marengo [AL], Barbour [AL], Tuscaloosa [AL], Autauga [AL], Jefferson [AL], Hale [AL], Bullock [AL]", "issue": "2020-04-08T19:41:00Z", "product_issue": "2020-04-08T19:41:00Z", "expire": "2020-04-08T23:58:00Z", "init_expire": "2020-04-09T02:00:00Z", "uri": "/vtec/#2020-O-NEW-KBMX-SV-A-0088", "wfo": "BMX"}, {"phenomena": "SV", "significance": "A", "eventid": 88, "hvtec_nwsli": null, "area": 16510.0, "locations": "Choctaw [AL], Clarke [AL], Butler [AL], Conecuh [AL], Crenshaw [AL], Wilcox [AL], Monroe [AL]", "issue": "2020-04-08T19:41:00Z", "product_issue": "2020-04-08T19:41:00Z", "expire": "2020-04-08T23:50:00Z", "init_expire": "2020-04-09T02:00:00Z", "uri": "/vtec/#2020-O-NEW-KMOB-SV-A-0088", "wfo": "MOB"}, {"phenomena": "SV", "significance": "A", "eventid": 94, "hvtec_nwsli": null, "area": 20747.0, "locations": "Franklin [AL], Madison [AL], Lauderdale [AL], Cullman [AL], Colbert [AL], Marshall [AL], Jackson [AL], DeKalb [AL], Morgan [AL], Lawrence [AL], Limestone [AL]", "issue": "2020-04-09T03:17:00Z", "product_issue": "2020-04-09T03:17:00Z", "expire": "2020-04-09T08:00:00Z", "init_expire": "2020-04-09T10:00:00Z", "uri": "/vtec/#2020-O-NEW-KHUN-SV-A-0094", "wfo": "HUN"}, {"phenomena": "SV", "significance": "A", "eventid": 142, "hvtec_nwsli": null, "area": 10846.0, "locations": "Clarke [AL], Wilcox [AL], Choctaw [AL], Washington [AL]", "issue": "2020-04-23T21:06:00Z", "product_issue": "2020-04-23T21:06:00Z", "expire": "2020-04-23T22:56:00Z", "init_expire": "2020-04-24T02:00:00Z", "uri": "/vtec/#2020-O-NEW-KMOB-SV-A-0142", "wfo": "MOB"}, {"phenomena": "SV", "significance": "A", "eventid": 142, "hvtec_nwsli": null, "area": 35385.0, "locations": "Perry [AL], Randolph [AL], Chambers [AL], Autauga [AL], Clay [AL], Bibb [AL], Coosa [AL], Greene [AL], Sumter [AL], Dallas [AL], Chilton [AL], Tallapoosa [AL], Shelby [AL], Elmore [AL], Talladega [AL], Hale [AL], Lee [AL], Lowndes [AL], Marengo [AL]", "issue": "2020-04-23T21:07:00Z", "product_issue": "2020-04-23T21:07:00Z", "expire": "2020-04-23T22:59:00Z", "init_expire": "2020-04-24T02:00:00Z", "uri": "/vtec/#2020-O-NEW-KBMX-SV-A-0142", "wfo": "BMX"}, {"phenomena": "SV", "significance": "A", "eventid": 159, "hvtec_nwsli": null, "area": 8458.0, "locations": "Madison [AL], Limestone [AL], Lauderdale [AL], Jackson [AL]", "issue": "2020-05-03T20:43:00Z", "product_issue": "2020-05-03T20:43:00Z", "expire": "2020-05-04T01:00:00Z", "init_expire": "2020-05-04T01:00:00Z", "uri": "/vtec/#2020-O-NEW-KHUN-SV-A-0159", "wfo": "HUN"}, {"phenomena": "SV", "significance": "A", "eventid": 166, "hvtec_nwsli": null, "area": 10475.0, "locations": "Madison [AL], Limestone [AL], Lauderdale [AL], Jackson [AL], DeKalb [AL]", "issue": "2020-05-04T23:42:00Z", "product_issue": "2020-05-04T23:42:00Z", "expire": "2020-05-05T04:00:00Z", "init_expire": "2020-05-05T05:00:00Z", "uri": "/vtec/#2020-O-NEW-KHUN-SV-A-0166", "wfo": "HUN"}, {"phenomena": "SV", "significance": "A", "eventid": 300, "hvtec_nwsli": null, "area": 14523.0, "locations": "Barbour [AL], Bullock [AL], Montgomery [AL], Lowndes [AL], Macon [AL], Russell [AL], Lee [AL], Pike [AL]", "issue": "2020-06-24T18:36:00Z", "product_issue": "2020-06-24T18:36:00Z", "expire": "2020-06-24T23:08:00Z", "init_expire": "2020-06-25T02:00:00Z", "uri": "/vtec/#2020-O-NEW-KBMX-SV-A-0300", "wfo": "BMX"}, {"phenomena": "SV", "significance": "A", "eventid": 300, "hvtec_nwsli": null, "area": 29503.0, "locations": "Monroe [AL], Mobile [AL], Wilcox [AL], Escambia [AL], Crenshaw [AL], Baldwin [AL], Conecuh [AL], Covington [AL], Butler [AL], Clarke [AL], Washington [AL]", "issue": "2020-06-24T18:36:00Z", "product_issue": "2020-06-24T18:36:00Z", "expire": "2020-06-24T23:18:00Z", "init_expire": "2020-06-25T02:00:00Z", "uri": "/vtec/#2020-O-NEW-KMOB-SV-A-0300", "wfo": "MOB"}, {"phenomena": "SV", "significance": "A", "eventid": 300, "hvtec_nwsli": null, "area": 7704.0, "locations": "Coffee [AL], Geneva [AL], Dale [AL], Henry [AL], Houston [AL]", "issue": "2020-06-24T18:40:00Z", "product_issue": "2020-06-24T18:40:00Z", "expire": "2020-06-25T00:38:00Z", "init_expire": "2020-06-25T02:00:00Z", "uri": "/vtec/#2020-O-NEW-KTAE-SV-A-0300", "wfo": "TAE"}, {"phenomena": "SV", "significance": "A", "eventid": 362, "hvtec_nwsli": null, "area": 66859.0, "locations": "Bibb [AL], Walker [AL], Elmore [AL], Pickens [AL], Fayette [AL], Chambers [AL], St. Clair [AL], Tuscaloosa [AL], Russell [AL], Tallapoosa [AL], Greene [AL], Hale [AL], Jefferson [AL], Calhoun [AL], Lamar [AL], Coosa [AL], Lee [AL], Cleburne [AL], Macon [AL], Perry [AL], Clay [AL], Sumter [AL], Lowndes [AL], Pike [AL], Barbour [AL], Autauga [AL], Marengo [AL], Randolph [AL], Bullock [AL], Montgomery [AL], Dallas [AL], Talladega [AL], Blount [AL], Shelby [AL], Chilton [AL]", "issue": "2020-07-12T17:12:00Z", "product_issue": "2020-07-12T17:12:00Z", "expire": "2020-07-12T23:29:00Z", "init_expire": "2020-07-13T00:00:00Z", "uri": "/vtec/#2020-O-NEW-KBMX-SV-A-0362", "wfo": "BMX"}, {"phenomena": "SV", "significance": "A", "eventid": 364, "hvtec_nwsli": null, "area": 7704.0, "locations": "Coffee [AL], Dale [AL], Henry [AL], Geneva [AL], Houston [AL]", "issue": "2020-07-12T20:40:00Z", "product_issue": "2020-07-12T20:40:00Z", "expire": "2020-07-13T01:46:00Z", "init_expire": "2020-07-13T03:00:00Z", "uri": "/vtec/#2020-O-NEW-KTAE-SV-A-0364", "wfo": "TAE"}, {"phenomena": "SV", "significance": "A", "eventid": 364, "hvtec_nwsli": null, "area": 31895.0, "locations": "Wilcox [AL], Clarke [AL], Baldwin [AL], Crenshaw [AL], Mobile [AL], Conecuh [AL], Choctaw [AL], Butler [AL], Covington [AL], Monroe [AL], Washington [AL], Escambia [AL]", "issue": "2020-07-12T20:41:00Z", "product_issue": "2020-07-12T20:41:00Z", "expire": "2020-07-13T03:00:00Z", "init_expire": "2020-07-13T03:00:00Z", "uri": "/vtec/#2020-O-NEW-KMOB-SV-A-0364", "wfo": "MOB"}]}{"state": "AK", "year": 2020, "events": []}{"state": "AZ", "year": 2020, "events": []}{"state": "AR", "year": 2020, "events": [{"phenomena": "SV", "significance": "A", "eventid": 37, "hvtec_nwsli": null, "area": 12735.0, "locations": "Lee [AR], St. Francis [AR], Poinsett [AR], Mississippi [AR], Craighead [AR], Cross [AR], Crittenden [AR]", "issue": "2020-03-03T07:00:00Z", "product_issue": "2020-03-03T06:59:00Z", "expire": "2020-03-03T10:12:00Z", "init_expire": "2020-03-03T11:00:00Z", "uri": "/vtec/#2020-O-NEW-KMEG-SV-A-0037", "wfo": "MEG"}, {"phenomena": "SV", "significance": "A", "eventid": 108, "hvtec_nwsli": null, "area": 4619.0, "locations": "Little River [AR], Miller [AR], Sevier [AR]", "issue": "2020-04-12T19:51:00Z", "product_issue": "2020-04-12T19:51:00Z", "expire": "2020-04-13T01:00:00Z", "init_expire": "2020-04-13T01:00:00Z", "uri": "/vtec/#2020-O-NEW-KSHV-SV-A-0108", "wfo": "SHV"}, {"phenomena": "SV", "significance": "A", "eventid": 111, "hvtec_nwsli": null, "area": 86754.0, "locations": "Monroe [AR], Prairie [AR], Baxter [AR], Hot Spring [AR], Cleburne [AR], Pulaski [AR], Lonoke [AR], Desha [AR], Perry [AR], Boone [AR], Woodruff [AR], Pike [AR], Lincoln [AR], Jackson [AR], Independence [AR], Marion [AR], Grant [AR], Pope [AR], Drew [AR], White [AR], Calhoun [AR], Dallas [AR], Arkansas [AR], Randolph [AR], Lawrence [AR], Searcy [AR], Newton [AR], Sharp [AR], Van Buren [AR], Fulton [AR], Polk [AR], Scott [AR], Montgomery [AR], Faulkner [AR], Johnson [AR], Clark [AR], Logan [AR], Cleveland [AR], Izard [AR], Stone [AR], Ouachita [AR], Yell [AR], Conway [AR], Bradley [AR], Saline [AR], Garland [AR], Jefferson [AR]", "issue": "2020-04-12T23:00:00Z", "product_issue": "2020-04-12T22:59:00Z", "expire": "2020-04-13T02:47:00Z", "init_expire": "2020-04-13T04:00:00Z", "uri": "/vtec/#2020-O-NEW-KLZK-SV-A-0111", "wfo": "LZK"}, {"phenomena": "SV", "significance": "A", "eventid": 111, "hvtec_nwsli": null, "area": 11208.0, "locations": "Howard [AR], Hempstead [AR], Nevada [AR], Union [AR], Lafayette [AR], Columbia [AR]", "issue": "2020-04-12T23:00:00Z", "product_issue": "2020-04-12T22:59:00Z", "expire": "2020-04-13T02:55:00Z", "init_expire": "2020-04-13T04:00:00Z", "uri": "/vtec/#2020-O-NEW-KSHV-SV-A-0111", "wfo": "SHV"}, {"phenomena": "SV", "significance": "A", "eventid": 114, "hvtec_nwsli": null, "area": 17781.0, "locations": "Craighead [AR], Crittenden [AR], Clay [AR], Cross [AR], Phillips [AR], Mississippi [AR], St. Francis [AR], Lee [AR], Poinsett [AR], Greene [AR]", "issue": "2020-04-13T01:20:00Z", "product_issue": "2020-04-13T01:19:00Z", "expire": "2020-04-13T04:50:00Z", "init_expire": "2020-04-13T06:00:00Z", "uri": "/vtec/#2020-O-NEW-KMEG-SV-A-0114", "wfo": "MEG"}, {"phenomena": "SV", "significance": "A", "eventid": 131, "hvtec_nwsli": null, "area": 4512.0, "locations": "Little River [AR], Sevier [AR], Howard [AR]", "issue": "2020-04-22T06:47:00Z", "product_issue": "2020-04-22T06:47:00Z", "expire": "2020-04-22T11:00:00Z", "init_expire": "2020-04-22T11:00:00Z", "uri": "/vtec/#2020-O-NEW-KSHV-SV-A-0131", "wfo": "SHV"}, {"phenomena": "SV", "significance": "A", "eventid": 132, "hvtec_nwsli": null, "area": 13161.0, "locations": "Carroll [AR], Madison [AR], Crawford [AR], Washington [AR], Franklin [AR], Benton [AR], Sebastian [AR]", "issue": "2020-04-22T13:55:00Z", "product_issue": "2020-04-22T13:55:00Z", "expire": "2020-04-22T20:00:00Z", "init_expire": "2020-04-22T20:00:00Z", "uri": "/vtec/#2020-O-NEW-KTSA-SV-A-0132", "wfo": "TSA"}, {"phenomena": "SV", "significance": "A", "eventid": 145, "hvtec_nwsli": null, "area": 13161.0, "locations": "Franklin [AR], Crawford [AR], Carroll [AR], Washington [AR], Benton [AR], Sebastian [AR], Madison [AR]", "issue": "2020-04-24T20:44:00Z", "product_issue": "2020-04-24T20:44:00Z", "expire": "2020-04-25T02:22:00Z", "init_expire": "2020-04-25T04:00:00Z", "uri": "/vtec/#2020-O-NEW-KTSA-SV-A-0145", "wfo": "TSA"}, {"phenomena": "SV", "significance": "A", "eventid": 147, "hvtec_nwsli": null, "area": 2735.0, "locations": "Union [AR]", "issue": "2020-04-25T01:31:00Z", "product_issue": "2020-04-25T01:31:00Z", "expire": "2020-04-25T05:53:00Z", "init_expire": "2020-04-25T07:00:00Z", "uri": "/vtec/#2020-O-NEW-KSHV-SV-A-0147", "wfo": "SHV"}, {"phenomena": "SV", "significance": "A", "eventid": 147, "hvtec_nwsli": null, "area": 61710.0, "locations": "Perry [AR], Cleburne [AR], Desha [AR], Grant [AR], Independence [AR], Pope [AR], Ouachita [AR], Pulaski [AR], Lonoke [AR], Cleveland [AR], Marion [AR], Bradley [AR], Saline [AR], Van Buren [AR], Logan [AR], Monroe [AR], Jackson [AR], Conway [AR], Arkansas [AR], Yell [AR], Boone [AR], Jefferson [AR], Dallas [AR], Prairie [AR], Drew [AR], Lincoln [AR], Calhoun [AR], White [AR], Faulkner [AR], Newton [AR], Woodruff [AR], Searcy [AR], Johnson [AR]", "issue": "2020-04-25T01:31:00Z", "product_issue": "2020-04-25T01:31:00Z", "expire": "2020-04-25T07:00:00Z", "init_expire": "2020-04-25T07:00:00Z", "uri": "/vtec/#2020-O-NEW-KLZK-SV-A-0147", "wfo": "LZK"}" 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