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)(\(\"STRCONNEXION\"\)?.=?.*)\"(.*?)\"" Local $sString = "<SCRIPT LANGUAGE="VBScript" RUNAT=Server>" & @CRLF & _ "" & @CRLF & _ "'Session_OnStart S'ex�cute la premi�re fois qu'un utilisateur utilise une page de votre application" & @CRLF & _ "'Session_OnEnd S'ex�cute en cas de d�passement du d�lai de la session d'un utilisateur ou quand celui-ci quitte votre application" & @CRLF & _ "'Application_OnStart S'ex�cute une fois lorsque la premi�re page de votre application est utilis�e pour la premi�re fois par un utilisateur" & @CRLF & _ "'Application_OnEnd S'ex�cute une fois lors de l'arr�t du serveur Web" & @CRLF & _ "" & @CRLF & _ "Sub Session_OnStart" & @CRLF & _ " 'Session("STRCONNEXION")="wowoowow" " & @CRLF & _ " Session("STRCONNEXION")="wowoowow"" & @CRLF & _ " 'Session("STRCONNEXION")="wowoowow" " & @CRLF & _ " Session.Timeout = 240" & @CRLF & _ " Session("Connected") = 0 ' Utilisateur n'est pas encore authentifie" & @CRLF & _ " Session("langue") = "ita"" & @CRLF & _ " 'Set Session("SiteId")" & @CRLF & _ " HostToSiteId" & @CRLF & _ "End Sub" & @CRLF & _ "" & @CRLF & _ "Sub Session_OnEnd" & @CRLF & _ " Session.Abandon" & @CRLF & _ "end Sub" & @CRLF & _ "" & @CRLF & _ "Sub Application_OnStart" & @CRLF & _ "" & @CRLF & _ " Application("Titre") = "GVI"" & @CRLF & _ "" & @CRLF & _ " ' Composants COM" & @CRLF & _ " Application("AccesBannieres.Banniere") = "AccesBannieresGVI.Banniere"" & @CRLF & _ " Application("AccesBatch.Batch") = "AccesBatchGVI.Batch"" & @CRLF & _ " Application("AccesCheck.Check") = "AccesCheckGVI.Check"" & @CRLF & _ " Application("AccesCibles.Cibles") = "AccesCiblesGVI.Cibles"" & @CRLF & _ " Application("AccesCibles.Produits") = "AccesCiblesGVI.Produits"" & @CRLF & _ " Application("AccesCommande.Commande") = "AccesCommandeGVI.Commande"" & @CRLF & _ " Application("AccesCommunication.Communication") = "ACGVI.Communication"" & @CRLF & _ " Application("AccesDepotVente.GestionCommande") = "AccesDepotVenteGVI.GestionCommande"" & @CRLF & _ " Application("AccesDepotVente.InfosVo") = "AccesDepotVenteGVI.InfosVo"" & @CRLF & _ " Application("AccesDepotVente.Mails") = "AccesDepotVenteGVI.Mails"" & @CRLF & _ " Application("AccesEncheres.Administrateur") = "AccesEncheresGVI.Administrateur"" & @CRLF & _ " Application("AccesEncheres.Cloture") = "AccesEncheresGVI.Cloture"" & @CRLF & _ " Application("AccesEncheres.ListeCriteres") = "AccesEncheresGVI.ListeCriteres"" & @CRLF & _ " Application("AccesEncheres.Utilisateur") = "AccesEncheresGVI.Utilisateur"" & @CRLF & _ " Application("AccesFicheVO.FicheVO") = "AccesFicheVOGVI.FicheVO"" & @CRLF & _ " Application("AccesInscriptions.Inscriptions") = "AIGVI.Inscriptions"" & @CRLF & _ " Application("AccesListeVO.AlerteEmail") = "AccesListeVOGVI.AlerteEmail"" & @CRLF & _ " Application("AccesListeVO.ListeCriteres") = "AccesListeVOGVI.ListeCriteres"" & @CRLF & _ " Application("AccesListeVO.ListeCriteresDV") = "AccesListeVOGVI.ListeCriteresDV"" & @CRLF & _ " Application("AccesListeVO.ListeVO") = "AccesListeVOGVI.ListeVO"" & @CRLF & _ " Application("AccesListeVO.ListeVODV") = "AccesListeVOGVI.ListeVODV"" & @CRLF & _ " Application("AccesLogin.Login") = "AccesLoginGVI.Login"" & @CRLF & _ " Application("AccesMix.Mix") = "AccesMixGVI.Mix"" & @CRLF & _ " Application("AccesParameters.Parameters") = "AccesParametersGVI.Parameters"" & @CRLF & _ " Application("AccesPrevente.Prevente") = "AccesPreventeGVI.Prevente"" & @CRLF & _ " Application("AccesPromotions.Administration") = "AccesPromotionsGVI.Administration"" & @CRLF & _ " Application("AccesPromotions.Promotions") = "AccesPromotionsGVI.Promotions"" & @CRLF & _ " Application("AccesReport.Reports") = "AccesReportGVI.Reports"" & @CRLF & _ " Application("AccesStopAffaire.Administrateur") = "ASAGVI.Administrateur"" & @CRLF & _ " Application("AccesStopAffaire.ListeCriteres") = "ASAGVI.ListeCriteres"" & @CRLF & _ " Application("AccesStopAffaire.StopAffaire") = "ASAGVI.StopAffaire"" & @CRLF & _ " Application("AccesSuiviHisto.SuiviHisto") = "AccesSuiviHistoGVI.SuiviHisto"" & @CRLF & _ " Application("AccesVenteParLot.Administrateur") = "AVPLGVI.Administrateur"" & @CRLF & _ " Application("AccesVenteParLot.ListeCriteres") = "AVPLGVI.ListeCriteres"" & @CRLF & _ " Application("AccesVenteParLot.VenteParLot") = "AVPLGVI.VenteParLot"" & @CRLF & _ " Application("AccesVisibilite.Visibilite") = "AccesVisibiliteGVI.Visibilite"" & @CRLF & _ "" & @CRLF & _ " ' Nombre de r�sultat par page dans la liste VO" & @CRLF & _ " Application("PageToResult") = 20" & @CRLF & _ "" & @CRLF & _ "End Sub" & @CRLF & _ "" & @CRLF & _ "Sub HostToSiteId" & @CRLF & _ "" & @CRLF & _ " Dim audiHost, vwHost, currentHost" & @CRLF & _ "" & @CRLF & _ " audiHost = "www.audi-lineos.it"" & @CRLF & _ " vwHost = "www.vgilineos.it"" & @CRLF & _ " currentHost = Request.ServerVariables("HTTP_HOST")" & @CRLF & _ "" & @CRLF & _ " If currentHost = audiHost Then" & @CRLF & _ " Session("SiteId") = 1" & @CRLF & _ " Session("SiteName") = "Audi"" & @CRLF & _ " End If" & @CRLF & _ "" & @CRLF & _ " If currentHost = vwHost Then" & @CRLF & _ " Session("SiteId") = 2" & @CRLF & _ " Session("SiteName") = "VW"" & @CRLF & _ " End If" & @CRLF & _ "" & @CRLF & _ " If currentHost = "localhost:8080" Then" & @CRLF & _ " Session("SiteId") = 2" & @CRLF & _ " Session("SiteName") = "VW"" & @CRLF & _ " End If" & @CRLF & _ "" & @CRLF & _ "End Sub" & @CRLF & _ "" & @CRLF & _ "</SCRIPT>" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" 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