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
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]
  • Character class intersection
    [\w&&[^\d]]
  • 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

import java.util.regex.Matcher; import java.util.regex.Pattern; public class Example { public static void main(String[] args) { final String regex = "\\s*(((\\d*).?(\\d*),(\\d*)).*VAL.*SOLDE LE\\s*((0[1-9]|[12][0-9]|3[01])\\/(0[1-9]|1[012])))"; final String string = " IBAN BE12 6115 1361 7292 BIC DEUTBEBE \n\n" + " 321,81 + VAL SOLDE LE 03/01 REF. \n\n" + "23/01 50,00 + 23/01 VIREMENT BE73 271 0141648 60 59991799 \n" + " BIETLOT FRANCOIS RUE DE PRAHY 14 \n" + " 5060 SAMBREVILLE BE \n" + " Com: CASH - ETRENNES AUGUSTIN MAMY \n" + " GISOU \n" + "23/01 50,00 + 23/01 VIREMENT BE73 271 0141648 60 59991899 \n" + " BIETLOT FRANCOIS RUE DE PRAHY 14 \n" + " 5060 SAMBREVILLE BE \n" + " Com: CASH - NAISSANCE AUGUSTIN \n" + " VALERIE \n" + "23/01 50,00 + 23/01 VIREMENT BE73 271 0141648 60 59991999 \n" + " BIETLOT FRANCOIS RUE DE PRAHY 14 \n" + " 5060 SAMBREVILLE BE \n\n" + " 471,81 + A REPORTER \n\n" + "EXTRAIT 002/001 E-ACCOUNT 611-5136172-92 EUR 05/04/18 \n\n\n\n" + " IBAN BE12 6115 1361 7292 BIC DEUTBEBE \n\n" + " 471,81 + REPORT A NOUVEAU \n\n" + " Com: CASH - ETRENNES AUGUSTIN NONO \n" + " MAMYLINE \n" + "12/02 20,00 - 12/02 VOTRE VIREMENT A BE73 271 0141648 60 59997800 \n" + " 1.1 Bietlot François \n" + " Com: /remb liquide/siege velo \n\n" + " 451,81 + SOLDE LE 12/02 \n\n" + "Les dépôts sur ce compte sont éligibles à la protection conformément à la loi \n" + "allemande sur la garantie des dépôts. Vous trouverez plus d'informations dans \n" + "la Fiche d'information du déposant disponible sur simple demande ou sur \n" + "www.deutschebank.be/media/pdf/informatieblad-fr.pdf \n\n\n\n\n" + "EXTRAIT 002/002 E-ACCOUNT 611-5136172-92 EUR 05/04/18 \n" + "TAUX D'INTERET DEBITEUR APPLIQUE : 5,87 % PAR AN. \n" + " \n" + " IBAN BE23 6115 1361 7191 BIC DEUTBEBE \n\n" + " 732,12 + VAL SOLDE LE 04/01 REF. \n\n" + "09/01 400,00 + 09/01 VIREMENT BE73 750 6414221 60 59995699 \n" + " BIETLOT FRANCOIS RUE DE PRAHY 14 \n" + " 5060 VELAINE-SUR-SAMBRE BE \n" + " Com: RESERVE CHARGES \n" + "07/02 400,00 + 07/02 VIREMENT BE73 750 6414221 60 59998199 \n" + " BIETLOT FRANCOIS RUE DE PRAHY 14 \n" + " 5060 VELAINE-SUR-SAMBRE BE \n" + " Com: RESERVE CHARGES \n" + "07/03 400,00 + 07/03 VIREMENT BE73 750 6414221 60 59993099 \n" + " BIETLOT FRANCOIS RUE DE PRAHY 14 \n" + " 5060 VELAINE-SUR-SAMBRE BE \n" + " Com: RESERVE CHARGES \n\n" + " 1.932,12 + SOLDE LE 07/03 \n\n\n" + "EXTRAIT 002/001 DB INTENSIV PLUS 611-5136171-91 EUR 05/04/18 \n\n\n\n" + " IBAN BE23 6115 1361 7191 BIC DEUTBEBE \n\n" + "Les dépôts sur ce compte sont éligibles à la protection conformément à la loi \n" + "allemande sur la garantie des dépôts. Vous trouverez plus d'informations dans \n" + "la Fiche d'information du déposant disponible sur simple demande ou sur \n" + "www.deutschebank.be/media/pdf/informatieblad-fr.pdf \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n" + "EXTRAIT 002/002 DB INTENSIV PLUS 611-5136171-91 EUR 05/04/18 \n" + " \n" + " IBAN BE65 6115 1361 7696 BIC DEUTBEBE \n\n" + " 344,83 + VAL SOLDE LE 12/01 REF. \n\n" + "05/04 0,22 + 01/04 PRIME DE FIDELITE TRIMESTRE 1 90000799 \n\n" + " 345,05 + SOLDE LE 05/04 \n\n" + "Les dépôts sur ce compte sont éligibles à la protection conformément à la loi \n" + "allemande sur la garantie des dépôts. Vous trouverez plus d'informations dans \n" + "la Fiche d'information du déposant disponible sur simple demande ou sur \n" + "www.deutschebank.be/media/pdf/informatieblad-fr.pdf \n\n\n\n\n\n\n" + "EXTRAIT 002/001 DB E-FIDELITY ACCOUNT 611-5136176-96 EUR 05/04/18 \n" + " \n" + " 611-5136170-90 19.02.18 \n\n" + "CREDITS TERMINAL : 403693/P2P MOBILE PERIODE : 048 00.00.00 \n" + "--------------------------------------------------------------------------- \n" + "TRANSACTION DATE/HEURE DONNEUR D'ORDRE MONTANT REFERENCE \n" + "--------------------------------------------------------------------------- \n" + "8984 17.02 20.06 001-7562717-91 46,40 P2P MOBILE \n\n\n\n\n\n\n\n\n\n\n\n\n" + " TOTAL : 46,40 EUR \n\n\n\n" + " DECOMPTE D'INTERETS ET FRAIS 03M DATE : 01/04/2018 \n\n" + " E-ACCOUNT 611-5136170-90 EUR 72/26 \n\n" + " 3,43 D INTERETS EN NOTRE FAVEUR \n\n" + " 3,43 D MONTANT NET - VALEUR 01/04/2018 \n" + " COMPTABILISE EN COMPTE \n\n\n\n\n\n\n\n" + " DROIT DE TIMBRE EUR 0,15 PAYE PAR LA BANQUE \n" + " \n" + "DECOMPTE PRIME DE FIDELITE TRIMESTRE 1(*) DATE : 05/04/2018 \n\n" + " DB E-Fidelity Account 611-5136176-96 EUR 72 \n\n" + " 0,22 C PRIME DE FIDELITE TRIMESTRE 1 \n\n" + " 0,22 C MONTANT NET - VALEUR 01/04/2018 \n" + " COMPTABILISE EN COMPTE \n\n\n\n\n" + "(*) LE MONTANT DE LA PRIME DE FIDELITE PEUT ETRE SUJET A DES MODIFICATIONS \n" + " EN CAS DE MOUVEMENT A UNE DATE ULTERIEURE AYANT UNE DATE VALEUR \n" + " DANS UN TRIMESTRE PRECEDENT. \n"; final Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE); final Matcher matcher = pattern.matcher(string); while (matcher.find()) { System.out.println("Full match: " + matcher.group(0)); for (int i = 1; i <= matcher.groupCount(); i++) { System.out.println("Group " + i + ": " + matcher.group(i)); } } } }

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 Java, please visit: https://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html