Regular Expressions 101

Save & Share

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)(?i)^(.+\.)?(myiqos|iqos)\.com$|^(www\.)?iqos\.([\\w]{1,3})(\.([\\w]{1,2}))?$" Local $sString = " am.iqos.com" & @CRLF & _ " Exclusive sales - iqos.cz" & @CRLF & _ " testdriveiqos.ru" & @CRLF & _ "ae.iqos.com" & @CRLF & _ "al.iqos.com" & @CRLF & _ "am.iqos.com" & @CRLF & _ "at.iqos.com" & @CRLF & _ "ba.iqos.com" & @CRLF & _ "bezdymu.pl" & @CRLF & _ "bg.iqos.com" & @CRLF & _ "boiler iqos.com" & @CRLF & _ "ca.iqos.com" & @CRLF & _ "calculate.iqosclub.co.uk" & @CRLF & _ "campanie-iqos.ro" & @CRLF & _ "ch.iqos.com" & @CRLF & _ "club.iqos.ro" & @CRLF & _ "club.it.iqos.com" & @CRLF & _ "co.iqos.com" & @CRLF & _ "companion.iqos.co.uk" & @CRLF & _ "comparteelcambio.com" & @CRLF & _ "conoce-iqos.com" & @CRLF & _ "conoceiqos.com" & @CRLF & _ "cr.iqosclub.com" & @CRLF & _ "cvspickup.com" & @CRLF & _ "cy.iqos.com" & @CRLF & _ "cz.club.iqos.com" & @CRLF & _ "cz.iqos.com" & @CRLF & _ "darwin.md" & @CRLF & _ "DCE 2." & @CRLF & _ "DCE2 - iqos.com" & @CRLF & _ "DCE2 - veev-vape.com" & @CRLF & _ "de.iqos.com" & @CRLF & _ "discover.iqos.gr" & @CRLF & _ "discoveriqos.com" & @CRLF & _ "dk.iqos.com" & @CRLF & _ "do.iqos.com" & @CRLF & _ "ec.myiqos.com" & @CRLF & _ "ee.iqos.com" & @CRLF & _ "enqueteiqos.com" & @CRLF & _ "es.iqos.com" & @CRLF & _ "essayeriqos.com" & @CRLF & _ "facturi.iqos.ro" & @CRLF & _ "Faramentol.ro" & @CRLF & _ "fastdelivery.sto" & @CRLF & _ "foodhouse.md" & @CRLF & _ "futurosinhumo.com" & @CRLF & _ "ganaconpmi.com" & @CRLF & _ "ge.iqos.com" & @CRLF & _ "getinfo.kr" & @CRLF & _ "gr.iqos.com" & @CRLF & _ "gt.iqos.com" & @CRLF & _ "heatnotburn.ro" & @CRLF & _ "heatnotburn.se" & @CRLF & _ "helloiqos.ro" & @CRLF & _ "hk.iqos.com" & @CRLF & _ "hr.iqos.com" & @CRLF & _ "hu.iqos.com" & @CRLF & _ "ic.pmiopen.com" & @CRLF & _ "il.iqos.com" & @CRLF & _ "intelege.iqos.ro" & @CRLF & _ "iqommunity.ro" & @CRLF & _ "iqos-care.nl" & @CRLF & _ "iqos-coach.com" & @CRLF & _ "iqos-on.ro" & @CRLF & _ "iqos-partner.ch" & @CRLF & _ "iqos.by" & @CRLF & _ "iqos.com" & @CRLF & _ "iqos.com (raw excl." & @CRLF & _ "iqos.com.ar" & @CRLF & _ "iqos.com.co" & @CRLF & _ "iqos.com.cw" & @CRLF & _ "iqos.com.ua" & @CRLF & _ "iqos.id" & @CRLF & _ "iqos.lv" & @CRLF & _ "iqos.ro" & @CRLF & _ "iqos.ro v1." & @CRLF & _ "iqos.ru" & @CRLF & _ "iqos.ru and shop.iqos.ru (Production) - Consolidated - Deprecated after 2018.11." & @CRLF & _ "iqos1year.com" & @CRLF & _ "iqos3.es" & @CRLF & _ "iqos3duo.es" & @CRLF & _ "iqosandco.es" & @CRLF & _ "iqosasia.com" & @CRLF & _ "iqosclub.cz" & @CRLF & _ "iqosclub.sk" & @CRLF & _ "iqosclubcanarias.com" & @CRLF & _ "iqoscr.com" & @CRLF & _ "iqosempfehlen.at" & @CRLF & _ "iqosexpert.ch" & @CRLF & _ "iqosinfo.at" & @CRLF & _ "iqositalia.it" & @CRLF & _ "iqosjetzt.com" & @CRLF & _ "iqosnc.com" & @CRLF & _ "iqosphere.jp" & @CRLF & _ "iqosplus.de" & @CRLF & _ "iqospointdevente.com" & @CRLF & _ "iqosprobieren.at" & @CRLF & _ "iqosregistrieren.at" & @CRLF & _ "iqosrent.nl" & @CRLF & _ "iqossvc.kr" & @CRLF & _ "iqostestdrive.ru" & @CRLF & _ "iqostesten.at" & @CRLF & _ "iqosveda.cz" & @CRLF & _ "iqosveda.sk" & @CRLF & _ "iqoswechseln.at" & @CRLF & _ "irefer.co.iqos.com" & @CRLF & _ "irefer.gt.iqos.com" & @CRLF & _ "irefer.my.iqos.com" & @CRLF & _ "it.iqos-boutique.com" & @CRLF & _ "it.iqos.com" & @CRLF & _ "it.veev-vape.com" & @CRLF & _ "jo.iqos.com" & @CRLF & _ "jp.iqos.com" & @CRLF & _ "kontaktai.iqos.lt" & @CRLF & _ "kr.iqos.com" & @CRLF & _ "kw.iqos.com" & @CRLF & _ "kz.iqos.com" & @CRLF & _ "lb.iqos.com" & @CRLF & _ "lil.iqos.ru" & @CRLF & _ "line.iqosphere.jp" & @CRLF & _ "lt.iqos.com" & @CRLF & _ "malaysia.iqos.com" & @CRLF & _ "mc.myiqos.com" & @CRLF & _ "md.iqos.com" & @CRLF & _ "me.iqos.com" & @CRLF & _ "menthol-ban-retail.co.uk" & @CRLF & _ "miasesoriqos.com" & @CRLF & _ "mk.iqos.com" & @CRLF & _ "mx.iqos.com" & @CRLF & _ "my.iqos.com" & @CRLF & _ "nazareth.iqos.co.il" & @CRLF & _ "newcreations.kr" & @CRLF & _ "nl.iqos.com" & @CRLF & _ "nokemuhara.jp" & @CRLF & _ "nuevoiqos3.es" & @CRLF & _ "nz.iqos.com" & @CRLF & _ "ocsg.chat.iqos.jp" & @CRLF & _ "offer.jp.iqos.com" & @CRLF & _ "openinsieme.com" & @CRLF & _ "pe.myiqos.com" & @CRLF & _ "pl.iqos.com" & @CRLF & _ "pmi.23video.com" & @CRLF & _ "probar-iqos.com" & @CRLF & _ "prohibicionmentolado2020.es" & @CRLF & _ "proibicao-mentol2020.pt" & @CRLF & _ "promisiunea.iqos.ro" & @CRLF & _ "provaiqos.it" & @CRLF & _ "pruebaiqos.es" & @CRLF & _ "ps.iqos.com" & @CRLF & _ "pt.iqos.com" & @CRLF & _ "qreator.ro" & @CRLF & _ "quiz.sogo-wp.com" & @CRLF & _ "re.iqos.com" & @CRLF & _ "referidos.iqos.com.co" & @CRLF & _ "referiqos.com" & @CRLF & _ "referiqosmy.com" & @CRLF & _ "register.iqos.id" & @CRLF & _ "rs.club.iqos.com" & @CRLF & _ "rs.iqos.com" & @CRLF & _ "sa.iqos.com" & @CRLF & _ "sahmatlafumat.iqos.ro" & @CRLF & _ "se.iqos.com" & @CRLF & _ "sg.myiqos.com" & @CRLF & _ "shareiqos.ch" & @CRLF & _ "shop.iqos.ru (Production) - Deprecated after 2018.11." & @CRLF & _ "shop.iqos.ru (raw) - Deprecated after 2018.11." & @CRLF & _ "si.iqos.com" & @CRLF & _ "sk.club.iqos.com" & @CRLF & _ "sk.iqos.com" & @CRLF & _ "smokefreeupdates.co.il" & @CRLF & _ "sms.sogo-wp.com" & @CRLF & _ "sogo-wp.com" & @CRLF & _ "stores.heattobacco.de" & @CRLF & _ "systemiqos.pl" & @CRLF & _ "teigaku.jp.iqos.com" & @CRLF & _ "testeiqos.at" & @CRLF & _ "testiqos.ch" & @CRLF & _ "testirajiqos.rs" & @CRLF & _ "timeforchanges.ch" & @CRLF & _ "tobacco-roll.co.il" & @CRLF & _ "tr.myiqos.com" & @CRLF & _ "trans.sogo-wp.com" & @CRLF & _ "tryiqos.ch" & @CRLF & _ "tryiqos.kr" & @CRLF & _ "tryiqos.ru" & @CRLF & _ "uk.iqos.com" & @CRLF & _ "uk.veev-vape.com" & @CRLF & _ "unsmoke.de" & @CRLF & _ "vn.iqos.com" & @CRLF & _ "www.iqos.com" & @CRLF & _ "www.iqosclub.ch" & @CRLF & _ "www.mystartapp.org" & @CRLF & _ "www.ordenar-unidades.com" & @CRLF & _ "Yext - de.iqos.com" & @CRLF & _ "yourdecision.ro" & @CRLF & _ "za.iqos.com" 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