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

/
/
gs

Test String

Substitution

Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "(?s).*?<AddressLine>([^<]+)<\/AddressLine>.*" Local $sString = "<ymaps xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/gml http://schemas.opengis.net/gml/3.1.1/base/gml.xsd http://maps.yandex.ru/ymaps/1.x https://maps.yandex.ru/schemas/ymaps/1.x/ymaps.xsd http://maps.yandex.ru/geocoder/1.x http://maps.yandex.ru/schemas/geocoder/1.x/geocoder.xsd http://maps.yandex.ru/address/1.x http://maps.yandex.ru/schemas/search/1.x/address.xsd urn:oasis:names:tc:ciq:xsdschema:xAL:2.0 http://docs.oasis-open.org/election/external/xAL.xsd">" & @CRLF & _ "<GeoObjectCollection>" & @CRLF & _ "<metaDataProperty xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<GeocoderResponseMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">" & @CRLF & _ "<request>56.751574,2038.573856</request>" & @CRLF & _ "<found>3</found>" & @CRLF & _ "<results>10</results>" & @CRLF & _ "</GeocoderResponseMetaData>" & @CRLF & _ "</metaDataProperty>" & @CRLF & _ "<featureMember xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<GeoObject xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:gml="http://www.opengis.net/gml" gml:id="1">" & @CRLF & _ "<metaDataProperty xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<GeocoderMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">" & @CRLF & _ "<kind>house</kind>" & @CRLF & _ "<text>Турция, Сакарья, Хендек, Ени, улица 2038, 56</text>" & @CRLF & _ "<precision>exact</precision>" & @CRLF & _ "<Address xmlns="http://maps.yandex.ru/address/1.x">" & @CRLF & _ "<country_code>TR</country_code>" & @CRLF & _ "<formatted>Турция, Сакарья, Хендек, Ени, улица 2038, 56</formatted>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>country</kind>" & @CRLF & _ "<name>Турция</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>province</kind>" & @CRLF & _ "<name>Сакарья</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>area</kind>" & @CRLF & _ "<name>Хендек</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>district</kind>" & @CRLF & _ "<name>Ени</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>street</kind>" & @CRLF & _ "<name>улица 2038</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>house</kind>" & @CRLF & _ "<name>56</name>" & @CRLF & _ "</Component>" & @CRLF & _ "</Address>" & @CRLF & _ "<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">" & @CRLF & _ "<Country>" & @CRLF & _ "<AddressLine>Турция, Сакарья, Хендек, Ени, улица 2038, 56</AddressLine>" & @CRLF & _ "<CountryNameCode>TR</CountryNameCode>" & @CRLF & _ "<CountryName>Турция</CountryName>" & @CRLF & _ "<AdministrativeArea>" & @CRLF & _ "<AdministrativeAreaName>Сакарья</AdministrativeAreaName>" & @CRLF & _ "<SubAdministrativeArea>" & @CRLF & _ "<SubAdministrativeAreaName>Хендек</SubAdministrativeAreaName>" & @CRLF & _ "<Locality>" & @CRLF & _ "<DependentLocality>" & @CRLF & _ "<DependentLocalityName>Ени</DependentLocalityName>" & @CRLF & _ "<Thoroughfare>" & @CRLF & _ "<ThoroughfareName>улица 2038</ThoroughfareName>" & @CRLF & _ "<Premise>" & @CRLF & _ "<PremiseNumber>56</PremiseNumber>" & @CRLF & _ "</Premise>" & @CRLF & _ "</Thoroughfare>" & @CRLF & _ "</DependentLocality>" & @CRLF & _ "</Locality>" & @CRLF & _ "</SubAdministrativeArea>" & @CRLF & _ "</AdministrativeArea>" & @CRLF & _ "</Country>" & @CRLF & _ "</AddressDetails>" & @CRLF & _ "</GeocoderMetaData>" & @CRLF & _ "</metaDataProperty>" & @CRLF & _ "<description xmlns="http://www.opengis.net/gml">Ени, Хендек, Сакарья, Турция</description>" & @CRLF & _ "<name xmlns="http://www.opengis.net/gml">улица 2038, 56</name>" & @CRLF & _ "<boundedBy xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<Envelope>" & @CRLF & _ "<lowerCorner>30.728833 40.789485</lowerCorner>" & @CRLF & _ "<upperCorner>30.737043 40.795725</upperCorner>" & @CRLF & _ "</Envelope>" & @CRLF & _ "</boundedBy>" & @CRLF & _ "<Point xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<pos>30.732938 40.792605</pos>" & @CRLF & _ "</Point>" & @CRLF & _ "</GeoObject>" & @CRLF & _ "</featureMember>" & @CRLF & _ "<featureMember xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<GeoObject xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:gml="http://www.opengis.net/gml" gml:id="2">" & @CRLF & _ "<metaDataProperty xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<GeocoderMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">" & @CRLF & _ "<kind>house</kind>" & @CRLF & _ "<text>Турция, Денизли, Памуккале, Джанкуртаран, улица 2038, 56</text>" & @CRLF & _ "<precision>exact</precision>" & @CRLF & _ "<Address xmlns="http://maps.yandex.ru/address/1.x">" & @CRLF & _ "<country_code>TR</country_code>" & @CRLF & _ "<formatted>Турция, Денизли, Памуккале, Джанкуртаран, улица 2038, 56</formatted>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>country</kind>" & @CRLF & _ "<name>Турция</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>province</kind>" & @CRLF & _ "<name>Денизли</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>area</kind>" & @CRLF & _ "<name>Памуккале</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>district</kind>" & @CRLF & _ "<name>Джанкуртаран</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>street</kind>" & @CRLF & _ "<name>улица 2038</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>house</kind>" & @CRLF & _ "<name>56</name>" & @CRLF & _ "</Component>" & @CRLF & _ "</Address>" & @CRLF & _ "<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">" & @CRLF & _ "<Country>" & @CRLF & _ "<AddressLine>Турция, Денизли, Памуккале, Джанкуртаран, улица 2038, 56</AddressLine>" & @CRLF & _ "<CountryNameCode>TR</CountryNameCode>" & @CRLF & _ "<CountryName>Турция</CountryName>" & @CRLF & _ "<AdministrativeArea>" & @CRLF & _ "<AdministrativeAreaName>Денизли</AdministrativeAreaName>" & @CRLF & _ "<SubAdministrativeArea>" & @CRLF & _ "<SubAdministrativeAreaName>Памуккале</SubAdministrativeAreaName>" & @CRLF & _ "<Locality>" & @CRLF & _ "<DependentLocality>" & @CRLF & _ "<DependentLocalityName>Джанкуртаран</DependentLocalityName>" & @CRLF & _ "<Thoroughfare>" & @CRLF & _ "<ThoroughfareName>улица 2038</ThoroughfareName>" & @CRLF & _ "<Premise>" & @CRLF & _ "<PremiseNumber>56</PremiseNumber>" & @CRLF & _ "</Premise>" & @CRLF & _ "</Thoroughfare>" & @CRLF & _ "</DependentLocality>" & @CRLF & _ "</Locality>" & @CRLF & _ "</SubAdministrativeArea>" & @CRLF & _ "</AdministrativeArea>" & @CRLF & _ "</Country>" & @CRLF & _ "</AddressDetails>" & @CRLF & _ "</GeocoderMetaData>" & @CRLF & _ "</metaDataProperty>" & @CRLF & _ "<description xmlns="http://www.opengis.net/gml">Джанкуртаран, Памуккале, Денизли, Турция</description>" & @CRLF & _ "<name xmlns="http://www.opengis.net/gml">улица 2038, 56</name>" & @CRLF & _ "<boundedBy xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<Envelope>" & @CRLF & _ "<lowerCorner>29.218953 37.67848</lowerCorner>" & @CRLF & _ "<upperCorner>29.227164 37.685006</upperCorner>" & @CRLF & _ "</Envelope>" & @CRLF & _ "</boundedBy>" & @CRLF & _ "<Point xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<pos>29.223059 37.681743</pos>" & @CRLF & _ "</Point>" & @CRLF & _ "</GeoObject>" & @CRLF & _ "</featureMember>" & @CRLF & _ "<featureMember xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<GeoObject xmlns="http://maps.yandex.ru/ymaps/1.x" xmlns:gml="http://www.opengis.net/gml" gml:id="3">" & @CRLF & _ "<metaDataProperty xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<GeocoderMetaData xmlns="http://maps.yandex.ru/geocoder/1.x">" & @CRLF & _ "<kind>house</kind>" & @CRLF & _ "<text>Турция, Адыяман, Адыяман Меркез, Сителер, улица 2038, 54</text>" & @CRLF & _ "<precision>near</precision>" & @CRLF & _ "<Address xmlns="http://maps.yandex.ru/address/1.x">" & @CRLF & _ "<country_code>TR</country_code>" & @CRLF & _ "<formatted>Турция, Адыяман, Адыяман Меркез, Сителер, улица 2038, 54</formatted>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>country</kind>" & @CRLF & _ "<name>Турция</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>province</kind>" & @CRLF & _ "<name>Адыяман</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>area</kind>" & @CRLF & _ "<name>Адыяман Меркез</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>district</kind>" & @CRLF & _ "<name>Сителер</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>street</kind>" & @CRLF & _ "<name>улица 2038</name>" & @CRLF & _ "</Component>" & @CRLF & _ "<Component>" & @CRLF & _ "<kind>house</kind>" & @CRLF & _ "<name>54</name>" & @CRLF & _ "</Component>" & @CRLF & _ "</Address>" & @CRLF & _ "<AddressDetails xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0">" & @CRLF & _ "<Country>" & @CRLF & _ "<AddressLine>Турция, Адыяман, Адыяман Меркез, Сителер, улица 2038, 54</AddressLine>" & @CRLF & _ "<CountryNameCode>TR</CountryNameCode>" & @CRLF & _ "<CountryName>Турция</CountryName>" & @CRLF & _ "<AdministrativeArea>" & @CRLF & _ "<AdministrativeAreaName>Адыяман</AdministrativeAreaName>" & @CRLF & _ "<SubAdministrativeArea>" & @CRLF & _ "<SubAdministrativeAreaName>Адыяман Меркез</SubAdministrativeAreaName>" & @CRLF & _ "<Locality>" & @CRLF & _ "<DependentLocality>" & @CRLF & _ "<DependentLocalityName>Сителер</DependentLocalityName>" & @CRLF & _ "<Thoroughfare>" & @CRLF & _ "<ThoroughfareName>улица 2038</ThoroughfareName>" & @CRLF & _ "<Premise>" & @CRLF & _ "<PremiseNumber>54</PremiseNumber>" & @CRLF & _ "</Premise>" & @CRLF & _ "</Thoroughfare>" & @CRLF & _ "</DependentLocality>" & @CRLF & _ "</Locality>" & @CRLF & _ "</SubAdministrativeArea>" & @CRLF & _ "</AdministrativeArea>" & @CRLF & _ "</Country>" & @CRLF & _ "</AddressDetails>" & @CRLF & _ "</GeocoderMetaData>" & @CRLF & _ "</metaDataProperty>" & @CRLF & _ "<description xmlns="http://www.opengis.net/gml">Сителер, Адыяман Меркез, Адыяман, Турция</description>" & @CRLF & _ "<name xmlns="http://www.opengis.net/gml">улица 2038, 54</name>" & @CRLF & _ "<boundedBy xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<Envelope>" & @CRLF & _ "<lowerCorner>38.291327 37.766104</lowerCorner>" & @CRLF & _ "<upperCorner>38.299537 37.772622</upperCorner>" & @CRLF & _ "</Envelope>" & @CRLF & _ "</boundedBy>" & @CRLF & _ "<Point xmlns="http://www.opengis.net/gml">" & @CRLF & _ "<pos>38.295432 37.769363</pos>" & @CRLF & _ "</Point>" & @CRLF & _ "</GeoObject>" & @CRLF & _ "</featureMember>" & @CRLF & _ "</GeoObjectCollection>" & @CRLF & _ "</ymaps>" Local $sSubst = "$1" Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst) MsgBox($MB_SYSTEMMODAL, "Result", $sResult)

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