Regular Expressions 101

Save & Share

  • Regex Version: ver. 2
  • 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
No Match

@"
"
gm

Test String

Substitution

Processing...

Code Generator

Generated Code

# If you'd like to omit non-matching lines from the result; add ';d' to the end of the expression. sed -E 's/(?<=\b(?:aa|ab|ace|ach|ady|aeb|ae|af|akk|als|am|ang|an|ar-latn|ary|arz|ar|ast|as|atj|avk|ay|az|ban|bar|ba|bcl|be-tarask|ber|be|bg|bh|bia|bi|bjn|bm|bn|bo|bpy|br|bs|bua|bxm|bxr|bxu|ca|cbk|ceb|ce|ch|ckb|cmn|cnr-cyrl|cnr-latn|cnr|co|cpf|crh|crs|cr|cs|cv|cy|dag|dak|da|de|dta|dv|dyu|dz|ee|egl|ekk|el|en-gb|en-us|en|eo|es|eto|et|eu|ext|fa|ff|fil|fi|fj|fo|fr-be|fr1835|frm|fro|frp|fr|fud|fur|fy|gag|ga|gcf-mq|gcf|gd|gez|gil|gl|gn|got|grc|gsw-ch|gsw-fr|gsw|gu|gv|hak|haw|ha|he|hif|hi|hr|hsb|ht|hu|hyw|hy|hz|ia|id|ie|ig|ii|ik|ilo|io|is|it|iu|ja-latn|ja|jv|kaa|kab|kaw|ka|kbd|kea|kg|ki|kk-arab|kk-cyrl|kk-latn|kk|kl|kmr|km|kn|ko|ksh|ks|ku|kv|kw|ky|kzg|lad|lang:mi|lang:mr|lang:nb|lang:non|lang:ve|la|lb|lfn|lij|li|lld|lmo|ln|lob|lou|lo|ltc|lt|lua|luo|lv|lzh|mey|mfe|mga|mg|mhr|mh|mk-cyrl|mk-latn|mk|ml|mn-cyrl|mn-latn|mn-mong|mnc|mn|moh|mo|mqm|mrq|ms|mt|mug|mus|mvf|mwl|myv|my|nah|nan|nap|naq|na|nds-nl|nds|nd|new|ne|niu|nl-be|nl|nn|no|nrf-je|nrf|nr|nso|nv|ny|och|oc|okn|om|or|osp|os|ota|otk|pal|pam|pap|pau|pa|pcd|pdc|pis|pi|pl|pms|pnt|prk|prs|ps|pt-br|pt|qu|rap|rar|rmy|rm|ro|ru-latn|rue|run|rup|ru|rw|ryu|sa|scn|sco|sc|sd|se|sga|sgs|sg|shy|sh|simple|si|sjo|sk|sli|slr|sl|smi|sm|snk|sn|so|sq|sr|ssf|st|su|sv|sw|syc|syr|szl|ta|tet|te|tg|th|ti|tk|tl|tmr|tn|tok|to|tpi|tr|tsg|ts|tts|tt|tvl|tw|tyv|ty|tzl|udm|ug|uhn|uk|ur|uz|vec|vep|vi|vls|vo|vro|war|wa|wls|woe|wo|wuu|xh|xmm|xsl|yak|yi|yoi|yo|yue|za|zea|zgh|zh-cn|zh-hans|zh-hant|zh-hk|zh-latn-pinyin|zh-mo|zh-sg|zh-tw|zh|zu|zza)\b) *}} *{{ *(?=\b(?:aa|ab|ace|ach|ady|aeb|ae|af|akk|als|am|ang|an|ar-latn|ary|arz|ar|ast|as|atj|avk|ay|az|ban|bar|ba|bcl|be-tarask|ber|be|bg|bh|bia|bi|bjn|bm|bn|bo|bpy|br|bs|bua|bxm|bxr|bxu|ca|cbk|ceb|ce|ch|ckb|cmn|cnr-cyrl|cnr-latn|cnr|co|cpf|crh|crs|cr|cs|cv|cy|dag|dak|da|de|dta|dv|dyu|dz|ee|egl|ekk|el|en-gb|en-us|en|eo|es|eto|et|eu|ext|fa|ff|fil|fi|fj|fo|fr-be|fr1835|frm|fro|frp|fr|fud|fur|fy|gag|ga|gcf-mq|gcf|gd|gez|gil|gl|gn|got|grc|gsw-ch|gsw-fr|gsw|gu|gv|hak|haw|ha|he|hif|hi|hr|hsb|ht|hu|hyw|hy|hz|ia|id|ie|ig|ii|ik|ilo|io|is|it|iu|ja-latn|ja|jv|kaa|kab|kaw|ka|kbd|kea|kg|ki|kk-arab|kk-cyrl|kk-latn|kk|kl|kmr|km|kn|ko|ksh|ks|ku|kv|kw|ky|kzg|lad|lang:mi|lang:mr|lang:nb|lang:non|lang:ve|la|lb|lfn|lij|li|lld|lmo|ln|lob|lou|lo|ltc|lt|lua|luo|lv|lzh|mey|mfe|mga|mg|mhr|mh|mk-cyrl|mk-latn|mk|ml|mn-cyrl|mn-latn|mn-mong|mnc|mn|moh|mo|mqm|mrq|ms|mt|mug|mus|mvf|mwl|myv|my|nah|nan|nap|naq|na|nds-nl|nds|nd|new|ne|niu|nl-be|nl|nn|no|nrf-je|nrf|nr|nso|nv|ny|och|oc|okn|om|or|osp|os|ota|otk|pal|pam|pap|pau|pa|pcd|pdc|pis|pi|pl|pms|pnt|prk|prs|ps|pt-br|pt|qu|rap|rar|rmy|rm|ro|ru-latn|rue|run|rup|ru|rw|ryu|sa|scn|sco|sc|sd|se|sga|sgs|sg|shy|sh|simple|si|sjo|sk|sli|slr|sl|smi|sm|snk|sn|so|sq|sr|ssf|st|su|sv|sw|syc|syr|szl|ta|tet|te|tg|th|ti|tk|tl|tmr|tn|tok|to|tpi|tr|tsg|ts|tts|tt|tvl|tw|tyv|ty|tzl|udm|ug|uhn|uk|ur|uz|vec|vep|vi|vls|vo|vro|war|wa|wls|woe|wo|wuu|xh|xmm|xsl|yak|yi|yoi|yo|yue|za|zea|zgh|zh-cn|zh-hans|zh-hant|zh-hk|zh-latn-pinyin|zh-mo|zh-sg|zh-tw|zh|zu|zza)\b)/|/gm;t' <<< "{{ab}}{{ab}}{{ab}}{{ab}}{{ab}}{{ab}} {{aa}} {{ab}} machintruc brun}} {{aa}} {{ab}} {{fr}} {{en}} {{de}} [http//truc] {{fi}} {{ luo }} {{ en-gb }} {{ zh-hant }}{{chapitre| {{de}}{{nl}}{{fi}} {{ luo }} {{ en-gb }} {{ zh-hant }} {{lien web| {{mr}} Trucmuche "

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 SED, please visit: https://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html