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

/
/

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 = "avi" Local $sString = "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Network Working Group D. Waitzman" & @CRLF & _ "Request for Comments: 2549 IronBridge Networks" & @CRLF & _ "Updates: 1149 1 April 1999" & @CRLF & _ "Category: Experimental" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " IP over Avian Carriers with Quality of Service" & @CRLF & _ "" & @CRLF & _ "Status of this Memo" & @CRLF & _ "" & @CRLF & _ " This memo defines an Experimental Protocol for the Internet" & @CRLF & _ " community. It does not specify an Internet standard of any kind." & @CRLF & _ " Discussion and suggestions for improvement are requested." & @CRLF & _ " Distribution of this memo is unlimited." & @CRLF & _ "" & @CRLF & _ "Copyright Notice" & @CRLF & _ "" & @CRLF & _ " Copyright (C) The Internet Society (1999). All Rights Reserved." & @CRLF & _ "" & @CRLF & _ "Abstract" & @CRLF & _ "" & @CRLF & _ " This memo amends RFC 1149, "A Standard for the Transmission of IP" & @CRLF & _ " Datagrams on Avian Carriers", with Quality of Service information." & @CRLF & _ " This is an experimental, not recommended standard." & @CRLF & _ "" & @CRLF & _ "Overview and Rational" & @CRLF & _ "" & @CRLF & _ " The following quality of service levels are available: Concorde," & @CRLF & _ " First, Business, and Coach. Concorde class offers expedited data" & @CRLF & _ " delivery. One major benefit to using Avian Carriers is that this is" & @CRLF & _ " the only networking technology that earns frequent flyer miles, plus" & @CRLF & _ " the Concorde and First classes of service earn 50% bonus miles per" & @CRLF & _ " packet. Ostriches are an alternate carrier that have much greater" & @CRLF & _ " bulk transfer capability but provide slower delivery, and require the" & @CRLF & _ " use of bridges between domains." & @CRLF & _ "" & @CRLF & _ " The service level is indicated on a per-carrier basis by bar-code" & @CRLF & _ " markings on the wing. One implementation strategy is for a bar-code" & @CRLF & _ " reader to scan each carrier as it enters the router and then enqueue" & @CRLF & _ " it in the proper queue, gated to prevent exit until the proper time." & @CRLF & _ " The carriers may sleep while enqueued." & @CRLF & _ "" & @CRLF & _ " For secure networks, carriers may have classes Prime or Choice." & @CRLF & _ " Prime carriers are self-keying when using public key encryption." & @CRLF & _ " Some distributors have been known to falsely classify Choice carriers" & @CRLF & _ " as Prime." & @CRLF & _ "" & @CRLF & _ " Packets MAY be marked for deletion using RED paint while enqueued." & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Waitzman Experimental [Page 1]" & @CRLF & _ " " & @CRLF & _ "RFC 2549 IP over Avian Carriers with QoS 1 April 1999" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " Weighted fair queueing (WFQ) MAY be implemented using scales, as" & @CRLF & _ " shown:" & @CRLF & _ "" & @CRLF & _ " __" & @CRLF & _ " _____/-----\ / o\" & @CRLF & _ " <____ _____\_/ >--" & @CRLF & _ " +-----+ \ / /______/" & @CRLF & _ " | 10g | /|:||/" & @CRLF & _ " +-----+ /____/|" & @CRLF & _ " | 10g | |" & @CRLF & _ " +-----+ .. X" & @CRLF & _ " ===============================" & @CRLF & _ " ^" & @CRLF & _ " |" & @CRLF & _ " =========" & @CRLF & _ "" & @CRLF & _ " Carriers in the queue too long may leave log entries, as shown on the" & @CRLF & _ " scale." & @CRLF & _ "" & @CRLF & _ " The following is a plot of traffic shaping, from coop-erative host" & @CRLF & _ " sites." & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " Alt | Plot of Traffic Shaping showing carriers in flight" & @CRLF & _ " |" & @CRLF & _ " 2k | ...................." & @CRLF & _ " | . ." & @CRLF & _ " | . ." & @CRLF & _ " 1k | . ." & @CRLF & _ " | +---+ +---+" & @CRLF & _ " | | A | | B |" & @CRLF & _ " | +---+ +---+" & @CRLF & _ " |_____________________________________________" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " Avian carriers normally bypass bridges and tunnels but will seek out" & @CRLF & _ " worm hole tunnels. When carrying web traffic, the carriers may" & @CRLF & _ " digest the spiders, leaving behind a more compact representation." & @CRLF & _ " The carriers may be confused by mirrors." & @CRLF & _ "" & @CRLF & _ " Round-robin queueing is not recommended. Robins make for well-tuned" & @CRLF & _ " networks but do not support the necessary auto-homing feature." & @CRLF & _ "" & @CRLF & _ " A BOF was held at the last IETF but only Avian Carriers were allowed" & @CRLF & _ " entry, so we don't know the results other than we're sure they think" & @CRLF & _ " MPLS is great. Our attempts at attaching labels to the carriers have" & @CRLF & _ " been met with resistance." & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Waitzman Experimental [Page 2]" & @CRLF & _ " " & @CRLF & _ "RFC 2549 IP over Avian Carriers with QoS 1 April 1999" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " NATs are not recommended either -- as with many protocols, modifying" & @CRLF & _ " the brain-embedded IP addresses is difficult, plus Avian Carriers MAY" & @CRLF & _ " eat the NATs." & @CRLF & _ "" & @CRLF & _ " Encapsulation may be done with saran wrappers. Unintentional" & @CRLF & _ " encapsulation in hawks has been known to occur, with decapsulation" & @CRLF & _ " being messy and the packets mangled." & @CRLF & _ "" & @CRLF & _ " Loose source routes are a viable evolutionary alternative enhanced" & @CRLF & _ " standards-based MSWindows-compliant technology, but strict source" & @CRLF & _ " routes MUST NOT be used, as they are a choke-point." & @CRLF & _ "" & @CRLF & _ " The ITU has offered the IETF formal alignment with its corresponding" & @CRLF & _ " technology, Penguins, but that won't fly." & @CRLF & _ "" & @CRLF & _ " Multicasting is supported, but requires the implementation of a clone" & @CRLF & _ " device. Carriers may be lost if they are based on a tree as it is" & @CRLF & _ " being pruned. The carriers propagate via an inheritance tree. The" & @CRLF & _ " carriers have an average TTL of 15 years, so their use in expanding" & @CRLF & _ " ring searches is limited." & @CRLF & _ "" & @CRLF & _ " Additional quality of service discussion can be found in a Michelin's" & @CRLF & _ " guide." & @CRLF & _ "" & @CRLF & _ "MIB and Management issues" & @CRLF & _ "" & @CRLF & _ " AvCarrier2 OBJECT-TYPE" & @CRLF & _ " SYNTAX SEQUENCE OF DNA" & @CRLF & _ " MAX-ACCESS can't-read" & @CRLF & _ " STATUS living" & @CRLF & _ " DESCRIPTION "Definition of an avian carrier"" & @CRLF & _ " ::= { life eukaryotes mitochondrial_eukaryotes crown_eukaryotes" & @CRLF & _ " metazoa chordata craniata vertebrata gnathostomata" & @CRLF & _ " sarcopterygii terrestrial_vertebrates amniota diapsida" & @CRLF & _ " archosauromorpha archosauria dinosauria aves neornithes" & @CRLF & _ " columbiformes columbidae columba livia }" & @CRLF & _ "" & @CRLF & _ " AvCarrier OBJECT-TYPE" & @CRLF & _ " SYNTAX SET OF Cells" & @CRLF & _ " MAX-ACCESS not-accessible" & @CRLF & _ " STATUS obsolete" & @CRLF & _ " DESCRIPTION "Definition of an avian carrier"" & @CRLF & _ " ::= { life animalia chordata vertebrata aves" & @CRLF & _ " columbiformes columbidae columba livia }" & @CRLF & _ "" & @CRLF & _ " PulseRate OBJECT-TYPE" & @CRLF & _ " SYNTAX Gauge(0..300)" & @CRLF & _ " MAX-ACCESS read-only" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Waitzman Experimental [Page 3]" & @CRLF & _ " " & @CRLF & _ "RFC 2549 IP over Avian Carriers with QoS 1 April 1999" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ " STATUS current" & @CRLF & _ " DESCRIPTION "Pulse rate of carrier, as measured in neck." & @CRLF & _ " Frequent sampling is disruptive to operations."" & @CRLF & _ " ::= { AvCarrier 1}" & @CRLF & _ "" & @CRLF & _ " The carriers will not line up in lexigraphic order but will" & @CRLF & _ " naturally order in a large V shape. Bulk retrieval is possible" & @CRLF & _ " using the Powerful Get-Net operator." & @CRLF & _ "" & @CRLF & _ "Specification of Requirements" & @CRLF & _ "" & @CRLF & _ " In this document, several words are used to signify the requirements" & @CRLF & _ " of the specification. These words are often capitalized." & @CRLF & _ "" & @CRLF & _ " MUST Usually." & @CRLF & _ "" & @CRLF & _ " MUST NOT Usually not." & @CRLF & _ "" & @CRLF & _ " SHOULD Only when Marketing insists." & @CRLF & _ "" & @CRLF & _ " MAY Only if it doesn't cost extra." & @CRLF & _ "" & @CRLF & _ "Security Considerations" & @CRLF & _ "" & @CRLF & _ " There are privacy issues with stool pigeons." & @CRLF & _ "" & @CRLF & _ " Agoraphobic carriers are very insecure in operation." & @CRLF & _ "" & @CRLF & _ "Patent Considerations" & @CRLF & _ "" & @CRLF & _ " There is ongoing litigation about which is the prior art: carrier or" & @CRLF & _ " egg." & @CRLF & _ "" & @CRLF & _ "References" & @CRLF & _ "" & @CRLF & _ " Waitzman, D., "A Standard for the Transmission of IP Datagrams on" & @CRLF & _ " Avian Carriers", RFC 1149, 1 April 1990." & @CRLF & _ "" & @CRLF & _ "ACKnowledgments" & @CRLF & _ "" & @CRLF & _ " Jim.Carlson.Ibnets.com > Jon.Saperia . ack 32 win 123 (DF)" & @CRLF & _ " Ross Callon, Scott Bradner, Charlie Lynn ..." & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Waitzman Experimental [Page 4]" & @CRLF & _ " " & @CRLF & _ "RFC 2549 IP over Avian Carriers with QoS 1 April 1999" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Author's Address" & @CRLF & _ "" & @CRLF & _ " David Waitzman" & @CRLF & _ " IronBridge Networks" & @CRLF & _ " 55 Hayden Ave" & @CRLF & _ " Lexington, MA 02421" & @CRLF & _ " Phone: (781) 372-8161" & @CRLF & _ "" & @CRLF & _ " EMail: djw@vineyard.net" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Waitzman Experimental [Page 5]" & @CRLF & _ " " & @CRLF & _ "RFC 2549 IP over Avian Carriers with QoS 1 April 1999" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Full Copyright Statement" & @CRLF & _ "" & @CRLF & _ " Copyright (C) The Internet Society (1999). All Rights Reserved." & @CRLF & _ "" & @CRLF & _ " This document and translations of it may be copied and furnished to" & @CRLF & _ " others, and derivative works that comment on or otherwise explain it" & @CRLF & _ " or assist in its implementation may be prepared, copied, published" & @CRLF & _ " and distributed, in whole or in part, without restriction of any" & @CRLF & _ " kind, provided that the above copyright notice and this paragraph are" & @CRLF & _ " included on all such copies and derivative works. However, this" & @CRLF & _ " document itself may not be modified in any way, such as by removing" & @CRLF & _ " the copyright notice or references to the Internet Society or other" & @CRLF & _ " Internet organizations, except as needed for the purpose of" & @CRLF & _ " developing Internet standards in which case the procedures for" & @CRLF & _ " copyrights defined in the Internet Standards process must be" & @CRLF & _ " followed, or as required to translate it into languages other than" & @CRLF & _ " English." & @CRLF & _ "" & @CRLF & _ " The limited permissions granted above are perpetual and will not be" & @CRLF & _ " revoked by the Internet Society or its successors or assigns." & @CRLF & _ "" & @CRLF & _ " This document and the information contained herein is provided on an" & @CRLF & _ " "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING" & @CRLF & _ " TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING" & @CRLF & _ " BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION" & @CRLF & _ " HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF" & @CRLF & _ " MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE." & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "" & @CRLF & _ "Waitzman Experimental [Page 6]" 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