Regular Expressions 101

Save & Share

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
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
  • Match everything enclosed
    (?:...)
  • Capture everything enclosed
    (...)
  • 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

r"
"
gmi

Test String

Code Generator

Generated Code

re = /(Apto Prof\.?e?s?i?o?n?a?l?)/mi str = 'VENTA de 3 AMBIENTES AL FRENTE 1 “A” , APTO PROFESIONAL, de 60 m2 cubiertos y 13 m2 semicubiertos de balcón aterrazado.Baño completo y toilette."CULLEN 5824" EDIFICIO CON ENTREGA INMEDIATA. LISTO PARA ESCRITURAR."ESPECIFICACIONES DE UNIDADES DE 3 AMBIENTES :Piso de porcelanato en linving y palier de distribución.Piso porcelanato símil madera en dormitorios.Pisos de cerámicas porcelaniticas color a definir en baños, balcones y cocina.Calefón a gas con encendido eléctrico.Horno embutido eléctrico y anafe a gas. (unidades separadas).Espejos en baños. Artefactos de 1ra. calidad tipo Ferrum ó Roca.Cerramientos línea Módena blanco.Mesada de granito y muebles bajo mesada y alacenas en cocinas.Placares de 2 Hojas corredizas, una hoja espejada.Pre instalación para colocación de aire acondicionado frío /calor en living y dormitorios.Cañería exclusiva para cable /TV (2) y telefonía independientes e interconectadas en unidades.ESPECIFICACIONES TÉCNICAS GENERALES DEL EDIFICIO EN CONSTRUCCIÓN:Terraza con parrilla, mesada de granito con bacha de acero y ducha.Portón automático en acceso a cocheras.Frente acceso en acero inoxidable, blindex.Ascensor con cabina de acero inoxidable.Hall de acceso al edificio y pallieres pisos de porcelanato pulido color a definir.COCHERAS OPCIONALES EN U$S 28.000Transportes CercanosColectivos:90, 107, 111, 114, 127, 140, 169PRECIO PAGO AL CONTADO: FORMA DE PAGO A CONVENIR, CONSULTE SALDO CON FINANCIACIÓN PROPIA.Necesitas mas información? Necesitas vender tu propiedad para comprar? esperamos tu llamado para asesorarte.GONZALEZ INMUEBLES Instagram: @gonzalez_inmueblesFacebook: gonzalez ID: 221464' # Print the match result str.scan(re) do |match| puts match.to_s end

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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html