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
No Match

@"
"
g

Test String

Substitution

Processing...

Code Generator

Generated Code

using System; using System.Text.RegularExpressions; public class Example { public static void Main() { string pattern = @"(?sm)^-(?:(?!^-\r?$).)*?^:86:(?!/..../)(?:(?!^-\r?$).)*"; string substitution = @""; string input = @"- :20:296535/00000010 :21:ABNADK2AXXX :25:ABNADK2AXXX/DK88ABNA0496434500 :28C:42/00002 :60M:C230228EUR124792,65 :61:2302280228C1750,88NTRFC1165-23-00120//656 :86:/TRTP/SEPA OVERBOEKING/IBAN/DK47ABNA0243508514/BIC/ABNADK2A/NAME/ LOOP BV/REMI/AV-RUN 24022023/202301918/EREF/C1165-23-00120 :61:2302280228C4695,98NTRF6381310605374038//656 :86:/TRTP/SEPA OVERBOEKING/IBAN/DK14ABNA0456766324/BIC/ABNADK2A/NAME/ DEV BV/REMI/ID16145 DEB. 1657139 FACT. 202303668 20 2303685 202303689/EREF/638131060537403857-311-2 :61:2302280228C1349,25NTRFNOTPROVIDED//658 :86:/TRTP/SEPA OVERBOEKING/IBAN/DK46ABNA0513892443/BIC/ABNADK2A/NAME/ EXAMPLE COM/REMI/202303656/EREF/NOTPROVIDED :61:2302280228C55845,96NTRFNOTPROVIDED//658 :86:/TRTP/SEPA OVERBOEKING/IBAN/DK35ABNA0442867689/BIC/ABNADK2A/NAME/ BATH COMPANY DK/REMI/INV. 202228255-8426, OUR REF 2022611 73-79/EREF/NOTPROVIDED :61:2302280228D105000,NTRFNOTPROVIDED//658 :86:/TRTP/SEPA OVERBOEKING/IBAN/DK98INGB0657624985/BIC/INGBDK2A/NAME/ TEST/REMI/OVERBOEKING/EREF/NOTPROVIDED :62F:C230228EUR83434,72 :64:C230228EUR83434,72 :86:/ACSI/ABNADK2AXXX - :20:STARTUMS TA FW :25:28020050/0521322890 :28C:017/01 :60F:C230228GBP1473111,27 :61:2302280228D1919,29N020NONREF :86:206?00AUSL-ZAHLUNG?100004649?20COMPANY?21S LT D?22TRN AZV2023022800746?23URSP.-BETR.1.900,00 GBP?24KURS 0,87716 0 EUR ZU GBP?25GEGENWERT 2.00,08 EUR?26PROVISION FIX 7 ,50 EUR?27SWIFT-/TELE-SPESEN 2,00 EUR?28FREMDE GEB. 12,50 E UR?2917.02 413337?3028020050?310537246190?32HOMETESTEXAMPLE?33S LTD?34003 :61:2302280228D16988,81N020NONREF :86:206?00AUSL-ZAHLUNG?100004649?20BODO GU COM?21NOT A TEST?22TRN AZV2023022800749?23URSP.-BETR.16.980,48 GBP?24 KURS 0,877160 EUR ZU GBP?25GEGENWERT 19.358,48 EUR?26PROVISIO N FIX 7,50 EUR?27SWIFT-/TELE-SPESEN 2,00 EUR?2830.01 INV-278 0?29*LOREM*?3028020050?310537246190?32GOLL ?33GOL COM?34003?60INFO 0800-1234 *GEB-FREI* :61:2302280228D867,06N020NONREF :86:206?00AUSL-ZAHLUNG?100004649?20NOTACOMPANY?21LTD?2 2TRN AZV2023022800752?23URSP.-BETR.858,73 GBP?24KURS 0,877160 EUR ZU GBP?25GEGENWERT 978,99 EUR?26PROVISION FIX 7,50 E UR?27SWIFT-/TELE-SPESEN 2,00 EUR?2828.01 A221322?3028020050?31053 7246190?32KOLL?33LTD?34003 :62F:C230228GBP1453336,11 -"; Regex regex = new Regex(pattern); string result = regex.Replace(input, substitution); } }

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 C#, please visit: https://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex(v=vs.110).aspx