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)<groupId>([^<]*)<\/groupId>\n[[:space:]]*<artifactId>([^<]*)<\/artifactId>\n[[:space:]]*<version>([^<]*)<\/version>" Local $sString = "<?xml version="1.0" encoding="UTF-8"?>" & @CRLF & _ "" & @CRLF & _ "<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">" & @CRLF & _ " <modelVersion>4.0.0</modelVersion>" & @CRLF & _ "" & @CRLF & _ " <groupId>com.bluesoft.muleesb</groupId>" & @CRLF & _ " <artifactId>Magellan23888Adapter</artifactId>" & @CRLF & _ " <version>1.0.0-SNAPSHOT</version>" & @CRLF & _ " <packaging>mule-application</packaging>" & @CRLF & _ "" & @CRLF & _ " <name>Magellan23888Adapter</name>" & @CRLF & _ "" & @CRLF & _ " <properties>" & @CRLF & _ " <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>" & @CRLF & _ " <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>" & @CRLF & _ " <app.runtime>4.3.0</app.runtime>" & @CRLF & _ " <mule.maven.plugin.version>3.3.5</mule.maven.plugin.version>" & @CRLF & _ " </properties>" & @CRLF & _ "" & @CRLF & _ " <build>" & @CRLF & _ " <plugins>" & @CRLF & _ " <plugin>" & @CRLF & _ " <groupId>org.mule.tools.maven</groupId>" & @CRLF & _ " <artifactId>mule-maven-plugin</artifactId>" & @CRLF & _ " <version>${mule.maven.plugin.version}</version>" & @CRLF & _ " <extensions>true</extensions>" & @CRLF & _ " <configuration>" & @CRLF & _ " <sharedLibraries>" & @CRLF & _ " <sharedLibrary>" & @CRLF & _ " <groupId>com.ibm.mq</groupId>" & @CRLF & _ " <artifactId>com.ibm.mq.allclient</artifactId>" & @CRLF & _ " </sharedLibrary>" & @CRLF & _ " </sharedLibraries>" & @CRLF & _ " <classifier>mule-application</classifier>" & @CRLF & _ " </configuration>" & @CRLF & _ " </plugin>" & @CRLF & _ " </plugins>" & @CRLF & _ " </build>" & @CRLF & _ " <distributionManagement>" & @CRLF & _ " <repository>" & @CRLF & _ " <id>releases</id>" & @CRLF & _ " <name>bluesoft releases</name>" & @CRLF & _ " <url>http://nexus.bluesoft.com/repository/releases</url>" & @CRLF & _ " </repository>" & @CRLF & _ " <snapshotRepository>" & @CRLF & _ " <id>snapshots</id>" & @CRLF & _ " <name>bluesoft snapshots</name>" & @CRLF & _ " <url>http://nexus.bluesoft.com/repository/snapshots</url>" & @CRLF & _ " </snapshotRepository>" & @CRLF & _ " </distributionManagement>" & @CRLF & _ " <dependencies>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>com.mulesoft.connectors</groupId>" & @CRLF & _ " <artifactId>mule-x12-connector</artifactId>" & @CRLF & _ " <version>2.6.2</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " <exclusions>" & @CRLF & _ " <exclusion>" & @CRLF & _ " <groupId>org.apache.logging.log4j</groupId>" & @CRLF & _ " <artifactId>log4j-core</artifactId>" & @CRLF & _ " </exclusion>" & @CRLF & _ " <exclusion>" & @CRLF & _ " <groupId>org.apache.logging.log4j</groupId>" & @CRLF & _ " <artifactId>log4j-api</artifactId>" & @CRLF & _ " </exclusion>" & @CRLF & _ " </exclusions>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.mule.connectors</groupId>" & @CRLF & _ " <artifactId>mule-objectstore-connector</artifactId>" & @CRLF & _ " <version>1.1.7</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>com.ibm.mq</groupId>" & @CRLF & _ " <artifactId>com.ibm.mq.allclient</artifactId>" & @CRLF & _ " <version>9.2.1.0</version>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.mule.modules</groupId>" & @CRLF & _ " <artifactId>mule-json-module</artifactId>" & @CRLF & _ " <version>2.1.3</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.apache.commons</groupId>" & @CRLF & _ " <artifactId>commons-lang3</artifactId>" & @CRLF & _ " <version>3.12.0</version>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.mule.connectors</groupId>" & @CRLF & _ " <artifactId>mule-http-connector</artifactId>" & @CRLF & _ " <version>1.5.6</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.mule.connectors</groupId>" & @CRLF & _ " <artifactId>mule-file-connector</artifactId>" & @CRLF & _ " <version>1.3.3</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>com.mulesoft.connectors</groupId>" & @CRLF & _ " <artifactId>mule-ibm-mq-connector</artifactId>" & @CRLF & _ " <version>1.6.3</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.mule.connectors</groupId>" & @CRLF & _ " <artifactId>mule-sftp-connector</artifactId>" & @CRLF & _ " <version>1.4.0</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>com.mulesoft.modules</groupId>" & @CRLF & _ " <artifactId>mule-secure-configuration-property-module</artifactId>" & @CRLF & _ " <version>1.1.0</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.mule.connectors</groupId>" & @CRLF & _ " <artifactId>mule-email-connector</artifactId>" & @CRLF & _ " <version>1.4.1</version>" & @CRLF & _ " <classifier>mule-plugin</classifier>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.apache.logging.log4j</groupId>" & @CRLF & _ " <artifactId>log4j-core</artifactId>" & @CRLF & _ " <version>2.16.0</version>" & @CRLF & _ " </dependency>" & @CRLF & _ " <dependency>" & @CRLF & _ " <groupId>org.apache.logging.log4j</groupId>" & @CRLF & _ " <artifactId>log4j-api</artifactId>" & @CRLF & _ " <version>2.16.0</version>" & @CRLF & _ " </dependency>" & @CRLF & _ " </dependencies>" & @CRLF & _ "" & @CRLF & _ " <repositories>" & @CRLF & _ " <repository>" & @CRLF & _ " <id>bluesoft-nexus</id>" & @CRLF & _ " <name>bluesoft Nexus</name>" & @CRLF & _ " <url>https://nexus.bluesoft.com/content/groups/public</url>" & @CRLF & _ " <layout>default</layout>" & @CRLF & _ " </repository>" & @CRLF & _ " </repositories>" & @CRLF & _ " <pluginRepositories>" & @CRLF & _ " <pluginRepository>" & @CRLF & _ " <id>bluesoft-nexus-plugins</id>" & @CRLF & _ " <name>bluesoft Nexus</name>" & @CRLF & _ " <layout>default</layout>" & @CRLF & _ " <url>https://nexus.bluesoft.com/content/groups/public</url>" & @CRLF & _ " <snapshots>" & @CRLF & _ " <enabled>false</enabled>" & @CRLF & _ " </snapshots>" & @CRLF & _ " </pluginRepository>" & @CRLF & _ " </pluginRepositories>" & @CRLF & _ "" & @CRLF & _ "</project>" 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