Regular Expressions 101

Save & Share

  • Regex Version: ver. 3
  • 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

/
/

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 = "air_temp": ([\d.]+)" Local $sString = " {" & @CRLF & _ " "observations": {" & @CRLF & _ " "notice": [" & @CRLF & _ " {" & @CRLF & _ " "copyright": "Copyright Commonwealth of Australia 2017, Bureau of Meteorology. For more information see: http://www.bom.gov.au/other/copyright.shtml http://www.bom.gov.au/other/disclaimer.shtml"," & @CRLF & _ " "copyright_url": "http://www.bom.gov.au/other/copyright.shtml"," & @CRLF & _ " "disclaimer_url": "http://www.bom.gov.au/other/disclaimer.shtml"," & @CRLF & _ " "feedback_url": "http://www.bom.gov.au/other/feedback"" & @CRLF & _ " }" & @CRLF & _ " ]," & @CRLF & _ " "header": [" & @CRLF & _ " {" & @CRLF & _ " "refresh_message": "Issued at 12:11 pm EST Tuesday 11 July 2017"," & @CRLF & _ " "ID": "IDN60901"," & @CRLF & _ " "main_ID": "IDN60902"," & @CRLF & _ " "name": "Canberra"," & @CRLF & _ " "state_time_zone": "NSW"," & @CRLF & _ " "time_zone": "EST"," & @CRLF & _ " "product_name": "Capital City Observations"," & @CRLF & _ " "state": "Aust Capital Territory"" & @CRLF & _ " }" & @CRLF & _ " ]," & @CRLF & _ " "data": [" & @CRLF & _ " {" & @CRLF & _ " "sort_order": 0," & @CRLF & _ " "wmo": 94926," & @CRLF & _ " "name": "Canberra"," & @CRLF & _ " "history_product": "IDN60903"," & @CRLF & _ " "local_date_time": "11/12:00pm"," & @CRLF & _ " "local_date_time_full": "20170711120000"," & @CRLF & _ " "aifstime_utc": "20170711020000"," & @CRLF & _ " "lat": -35.3," & @CRLF & _ " "lon": 149.2," & @CRLF & _ " "apparent_t": 5.7," & @CRLF & _ " "cloud": "Mostly clear"," & @CRLF & _ " "cloud_base_m": 1050," & @CRLF & _ " "cloud_oktas": 1," & @CRLF & _ " "cloud_type_id": 8," & @CRLF & _ " "cloud_type": "Cumulus"," & @CRLF & _ " "delta_t": 3.6," & @CRLF & _ " "gust_kmh": 11," & @CRLF & _ " "gust_kt": 6," & @CRLF & _ " "air_temp": 9.0," & @CRLF & _ " "dewpt": 0.2," & @CRLF & _ " "press": 1032.7," & @CRLF & _ " "press_qnh": 1031.3," & @CRLF & _ " "press_msl": 1032.7," & @CRLF & _ " "press_tend": "-"," & @CRLF & _ " "rain_trace": "0.0"," & @CRLF & _ " "rel_hum": 54," & @CRLF & _ " "sea_state": "-"," & @CRLF & _ " "swell_dir_worded": "-"," & @CRLF & _ " "swell_height": null," & @CRLF & _ " "swell_period": null," & @CRLF & _ " "vis_km": "10"," & @CRLF & _ " "weather": "-"," & @CRLF & _ " "wind_dir": "WNW"," & @CRLF & _ " "wind_spd_kmh": 7," & @CRLF & _ " "wind_spd_kt": 4" & @CRLF & _ " }," & @CRLF & _ " {" & @CRLF & _ " "sort_order": 1," & @CRLF & _ " "wmo": 94926," & @CRLF & _ " "name": "Canberra"," & @CRLF & _ " "history_product": "IDN60903"," & @CRLF & _ " "local_date_time": "11/11:30am"," & @CRLF & _ " "local_date_time_full": "20170711113000"," & @CRLF & _ " "aifstime_utc": "20170711013000"," & @CRLF & _ " "lat": -35.3," & @CRLF & _ " "lon": 149.2," & @CRLF & _ " "apparent_t": 4.6," & @CRLF & _ " "cloud": "Mostly clear"," & @CRLF & _ " "cloud_base_m": 900," & @CRLF & _ " "cloud_oktas": 1," & @CRLF & _ " "cloud_type_id": 8," & @CRLF & _ " "cloud_type": "Cumulus"," & @CRLF & _ " "delta_t": 2.9," & @CRLF & _ " "gust_kmh": 9," & @CRLF & _ " "gust_kt": 5," & @CRLF & _ " "air_temp": 7.3," & @CRLF & _ " "dewpt": 0.1," & @CRLF & _ " "press": 1033.1," & @CRLF & _ " "press_qnh": 1031.7," & @CRLF & _ " "press_msl": 1033.1," & @CRLF & _ " "press_tend": "-"," & @CRLF & _ " "rain_trace": "0.0"," & @CRLF & _ " "rel_hum": 60," & @CRLF & _ " "sea_state": "-"," & @CRLF & _ " "swell_dir_worded": "-"," & @CRLF & _ " "swell_height": null," & @CRLF & _ " "swell_period": null," & @CRLF & _ " "vis_km": "10"," & @CRLF & _ " "weather": "-"," & @CRLF & _ " "wind_dir": "NW"," & @CRLF & _ " "wind_spd_kmh": 4," & @CRLF & _ " "wind_spd_kt": 2" & @CRLF & _ " }" & @CRLF & _ " ]" & @CRLF & _ " }" & @CRLF & _ "}" Local $aArray = StringRegExp($sString, $sRegex, $STR_REGEXPARRAYFULLMATCH) ; 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