Regular Expressions 101

Save & Manage Regex

  • Current Version: 12
  • 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]
  • 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

Substitution
Processing...

Code Generator

Generated Code

#include <MsgBoxConstants.au3> ; to declare the Constants of MsgBox Local $sRegex = "(?u)([0-9]+)\s+(\w+,?)\s+(\w+).*?\r?\n•\s+([\s\S]*?)\s+[0-9]+\s\|.*\s*" Local $sString = "1 el, la art the" & @CRLF & _ "• esa mujer era la mujer que yo quería ser" & @CRLF & _ "100 | 2037803" & @CRLF & _ "" & @CRLF & _ "2 de prep of, from" & @CRLF & _ "• el hijo de un hermano mío" & @CRLF & _ "100 | 1319834" & @CRLF & _ "" & @CRLF & _ "3 que conj that, which" & @CRLF & _ "• dice que no" & @CRLF & _ "100 | 662653" & @CRLF & _ "" & @CRLF & _ "4 y conj and" & @CRLF & _ "• él y ella sabían leer y escribir" & @CRLF & _ "100 | 562162" & @CRLF & _ "" & @CRLF & _ "5 a prep to, at" & @CRLF & _ "• se fue a la cama" & @CRLF & _ "100 | 529899" & @CRLF & _ "" & @CRLF & _ "6 en prep in, on" & @CRLF & _ "• no está en la casa" & @CRLF & _ "100 | 507233" & @CRLF & _ "" & @CRLF & _ "7 un art a, an" & @CRLF & _ "• era un hombre simpático" & @CRLF & _ "100 | 434022" & @CRLF & _ "" & @CRLF & _ "8 ser v to be (norm)" & @CRLF & _ "• es nuevo, es bueno" & @CRLF & _ "100 | 374194 +o" & @CRLF & _ "" & @CRLF & _ "9 se pron [“reflexive” marker]" & @CRLF & _ "• la abuela se acostó tranquila" & @CRLF & _ "100 | 329012" & @CRLF & _ "" & @CRLF & _ "10 no adv no" & @CRLF & _ "• no hay modo de negar nada" & @CRLF & _ "100 | 257365 +o" & @CRLF & _ "" & @CRLF & _ "11 haber v to have (+Ved)" & @CRLF & _ "• no ha dicho nada" & @CRLF & _ "100 | 196962" & @CRLF & _ "" & @CRLF & _ "12 por prep by, for, through" & @CRLF & _ "• así fue por mucho tiempo" & @CRLF & _ "100 | 190975" & @CRLF & _ "" & @CRLF & _ "13 con prep with" & @CRLF & _ "• hay un hombre con ella" & @CRLF & _ "100 | 184597" & @CRLF & _ "" & @CRLF & _ "14 su adj his/her/their/your (–fam)" & @CRLF & _ "• ¿quién era? ¿Su hermana? ¿Su amiga?" & @CRLF & _ "100 | 187810" & @CRLF & _ "" & @CRLF & _ "15 para prep for, to, in order to" & @CRLF & _ "• ¡tengo una sorpresa sensacional para ti!" & @CRLF & _ "100 | 126061" & @CRLF & _ "" & @CRLF & _ "16 como conj like, as" & @CRLF & _ "• ser compositor en España es como ser torero" & @CRLF & _ "en Finlandia" & @CRLF & _ "100 | 106840" & @CRLF & _ "" & @CRLF & _ "17 estar v to be (location, change from norm)" & @CRLF & _ "• él está en el trabajo" & @CRLF & _ "100 | 106429 +o" & @CRLF & _ "" & @CRLF & _ "18 tener v to have" & @CRLF & _ "• estaba seguro de tener buena memoria" & @CRLF & _ "100 | 106642 +o" & @CRLF & _ "" & @CRLF & _ "19 le pron [3rd person] (indir obj)" & @CRLF & _ "• nunca le dijo la verdad" & @CRLF & _ "100 | 98211" & @CRLF & _ "" & @CRLF & _ "20 lo art the (+ n)" & @CRLF & _ "• lo mejor es estudiar mucho" & @CRLF & _ "100 | 91035" & @CRLF & _ "" & @CRLF & _ "21 lo pron [3rd person] (dir obj-m)" & @CRLF & _ "• lo compré en la tienda" & @CRLF & _ "100 | 92519" & @CRLF & _ "" & @CRLF & _ "22 todo adj all, every" & @CRLF & _ "• todos los hombres son iguales" & @CRLF & _ "100 | 88057" & @CRLF & _ "" & @CRLF & _ "23 pero conj but, yet, except" & @CRLF & _ "• no significa nada para mí, pero no puedo" & @CRLF & _ "olvidarla" & @CRLF & _ "100 | 82435 +o" & @CRLF & _ "" & @CRLF & _ "24 más adj more" & @CRLF & _ "• él necesitaba más dinero" & @CRLF & _ "100 | 92352" & @CRLF & _ "" & @CRLF & _ "25 hacer v to do, make" & @CRLF & _ "• he podido hacer lo que me gusta" & @CRLF & _ "100 | 81619" & @CRLF & _ "" & @CRLF & _ "26 o conj or" & @CRLF & _ "• sí esperaba uno o dos muertos" & @CRLF & _ "100 | 82444" & @CRLF & _ "" & @CRLF & _ "27 poder v to be able to; can" & @CRLF & _ "• ¡se hace lo que se puede!" & @CRLF & _ "100 | 76738" & @CRLF & _ "" & @CRLF & _ "28 decir v to tell, say" & @CRLF & _ "• parece que dice la verdad" & @CRLF & _ "100 | 79343 +o" & @CRLF & _ "" & @CRLF & _ "29 este adj this (m) [esta (f)]" & @CRLF & _ "• y entendía estas cosas muy bien" & @CRLF & _ "100 | 80544" & @CRLF & _ "" & @CRLF & _ "30 ir v to go" & @CRLF & _ "• me habían invitado a ir a su casa" & @CRLF & _ "100 | 70352 +o" & @CRLF & _ "" & @CRLF & _ "31 otro adj other, another" & @CRLF & _ "• ¿por qué no podía ser otra cosa?" & @CRLF & _ "100 | 61726" & @CRLF & _ "" & @CRLF & _ "32 ese adj that (m) [esa (f)]" & @CRLF & _ "• ¿dónde viven esas mujeres?" & @CRLF & _ "100 | 60989 +o" & @CRLF & _ "" & @CRLF & _ "33 la pron [3rd person] (dir obj-f)" & @CRLF & _ "• la puso en su bolsillo" & @CRLF & _ "100 | 55523" & @CRLF & _ "" & @CRLF & _ "34 si conj if, whether" & @CRLF & _ "• si quiere cazar, vamos a cazar" & @CRLF & _ "100 | 53608" & @CRLF & _ "" & @CRLF & _ "35 me pron me (obj)" & @CRLF & _ "• ¿cuando me va a llamar?" & @CRLF & _ "97 | 95577 +o" & @CRLF & _ "" & @CRLF & _ "36 ya adv already, still" & @CRLF & _ "• su marido ya ha dicho todo" & @CRLF & _ "100 | 46778 +o" & @CRLF & _ "" & @CRLF & _ "37 ver v to see" & @CRLF & _ "• había que subir para ver las ruinas" & @CRLF & _ "100 | 45854 +o" & @CRLF & _ "" & @CRLF & _ "38 porque conj because" & @CRLF & _ "• lo vendo sólo porque tengo un apuro muy" & @CRLF & _ "grande" & @CRLF & _ "100 | 44500 +o" & @CRLF & _ "" & @CRLF & _ "39 dar v to give" & @CRLF & _ "• me dio esta carta para Ud." & @CRLF & _ "100 | 40233" & @CRLF & _ "" & @CRLF & _ "40 cuando conj when" & @CRLF & _ "• aquella es de mis nietos, cuando eran bebés" & @CRLF & _ "100 | 39726" & @CRLF & _ "" & @CRLF & _ "41 él pron he, [ellos] them (m)" & @CRLF & _ "• él es bastante simpático" & @CRLF & _ "100 | 38597" & @CRLF & _ "" & @CRLF & _ "42 muy adv very, really" & @CRLF & _ "• está muy contento con mi trabajo" & @CRLF & _ "100 | 39558 +o" & @CRLF & _ "" & @CRLF & _ "43 sin prep without" & @CRLF & _ "• se habían quedado sin dinero" & @CRLF & _ "100 | 40432" & @CRLF & _ "" & @CRLF & _ "44 vez nf time (specific occurrence)" & @CRLF & _ "• es la primera vez que estoy junto al mar" & @CRLF & _ "100 | 35286" & @CRLF & _ "" & @CRLF & _ "45 mucho adj much, many, a lot (adv)" & @CRLF & _ "• por lo visto tienen mucho dinero" & @CRLF & _ "100 | 36391 +o" & @CRLF & _ "" & @CRLF & _ "46 saber v to know (a fact), find out" & @CRLF & _ "• ellos lo saben y lo reconocen" & @CRLF & _ "100 | 37092 +o" & @CRLF & _ "" & @CRLF & _ "47 qué pron what?, which?, how (+ adj)!" & @CRLF & _ "• no sé qué voy a hacer" & @CRLF & _ "100 | 42000 +o" & @CRLF & _ "" & @CRLF & _ "48 sobre prep on top of, over, about" & @CRLF & _ "• dejó el papel sobre la mesa y se fue" & @CRLF & _ "100 | 35038" & @CRLF & _ "" & @CRLF & _ "49 mi adj my" & @CRLF & _ "• mi casa es su casa" & @CRLF & _ "99 | 45636 +o" & @CRLF & _ "" & @CRLF & _ "50 alguno adj some, someone (pron)" & @CRLF & _ "• habló algunas palabras con el agente de" & @CRLF & _ "negocios" & @CRLF & _ "100 | 30485" & @CRLF & _ "" & @CRLF & _ "51 mismo adj same" & @CRLF & _ "• pronunciando el mismo discurso en siete" & @CRLF & _ "idiomas" & @CRLF & _ "100 | 29569" & @CRLF & _ "" & @CRLF & _ "52 yo pron I (subj)" & @CRLF & _ "• ¡Yo soy el padre!" & @CRLF & _ "98 | 54635 +o" & @CRLF & _ "" & @CRLF & _ "53 también adv also" & @CRLF & _ "• y también van a estar los otros" & @CRLF & _ "100 | 33348" & @CRLF & _ "" & @CRLF & _ "54 hasta prep until, up to, even (adv)" & @CRLF & _ "• toda la noche, hasta las tres de la mañana" & @CRLF & _ "100 | 29506" & @CRLF & _ "" & @CRLF & _ "55 año nm year" & @CRLF & _ "• no lo supo hasta casi un año después" & @CRLF & _ "100 | 33053" & @CRLF & _ "" & @CRLF & _ "56 dos num two" & @CRLF & _ "• de allí salieron dos hermanas solteras" & @CRLF & _ "100 | 27733" & @CRLF & _ "" & @CRLF & _ "57 querer v to want, love" & @CRLF & _ "• quiero que este proceso salga con limpieza" & @CRLF & _ "100 | 28696 +o" & @CRLF & _ "" & @CRLF & _ "58 entre prep between, among" & @CRLF & _ "• la cosa es entre tú y yo" & @CRLF & _ "100 | 30756" & @CRLF & _ "" & @CRLF & _ "59 así adv like that" & @CRLF & _ "• la vida es así" & @CRLF & _ "100 | 24832" & @CRLF & _ "" & @CRLF & _ "60 primero adj first" & @CRLF & _ "• las primeras palabras que nos enseñan a leer y" & @CRLF & _ "escribir" & @CRLF & _ "100 | 26553" & @CRLF & _ "" & @CRLF & _ "61 desde prep from, since" & @CRLF & _ "• lo había pensado desde el primer momento" & @CRLF & _ "100 | 25288" & @CRLF & _ "" & @CRLF & _ "62 grande adj large, great, big" & @CRLF & _ "• lo ha mirado a los grandes ojos negros" & @CRLF & _ "100 | 25963" & @CRLF & _ "" & @CRLF & _ "63 eso pron that (n)" & @CRLF & _ "• y eso no es todo" & @CRLF & _ "99 | 31636 +o" & @CRLF & _ "" & @CRLF & _ "64 ni conj not even, neither, nor" & @CRLF & _ "• pero ni eso me tranquilizó" & @CRLF & _ "100 | 24261" & @CRLF & _ "" & @CRLF & _ "65 nos pron us (obj)" & @CRLF & _ "• nos vio en la calle" & @CRLF & _ "99 | 26349 +o" & @CRLF & _ "" & @CRLF & _ "66 llegar v to arrive" & @CRLF & _ "• como para llegar hasta el fondo de las almas" & @CRLF & _ "100 | 22878" & @CRLF & _ "" & @CRLF & _ "67 pasar v to pass, spend (time)" & @CRLF & _ "• tras la ventana lo veo pasar una y otra vez" & @CRLF & _ "100 | 22466" & @CRLF & _ "" & @CRLF & _ "68 tiempo nm time (general), weather" & @CRLF & _ "• he estado mucho tiempo con ella" & @CRLF & _ "100 | 22432" & @CRLF & _ "" & @CRLF & _ "69 ella pron she, [ellas] them (f)" & @CRLF & _ "• ella es muy estudiosa" & @CRLF & _ "100 | 24770" & @CRLF & _ "" & @CRLF & _ "70 sí adv yes" & @CRLF & _ "• quiero una respuesta concreta: sí o no" & @CRLF & _ "100 | 33828 +o" & @CRLF & _ "" & @CRLF & _ "71 día nm day" & @CRLF & _ "• cada día hay más problemas" & @CRLF & _ "100 | 24715" & @CRLF & _ "" & @CRLF & _ "72 uno num one" & @CRLF & _ "• hay uno que ya lo está haciendo" & @CRLF & _ "100 | 21407 +o" & @CRLF & _ "" & @CRLF & _ "73 bien adv well" & @CRLF & _ "• y entonces hice bien en quedarme" & @CRLF & _ "100 | 21589 +o" & @CRLF & _ "" & @CRLF & _ "74 poco adj little, few, a little bit (adv)" & @CRLF & _ "• trabajó poco tiempo con él" & @CRLF & _ "100 | 20986" & @CRLF & _ "" & @CRLF & _ "75 deber v should, ought to; to owe" & @CRLF & _ "• te debes calmar, le aconsejó T." & @CRLF & _ "100 | 22232" & @CRLF & _ "" & @CRLF & _ "76 entonces adv so, then" & @CRLF & _ "• vamos entonces a cambiarlo" & @CRLF & _ "100 | 23548 +o" & @CRLF & _ "" & @CRLF & _ "77 poner v to put (on), get (+adj)" & @CRLF & _ "• puso el cuchillo en manos de M." & @CRLF & _ "100 | 20330" & @CRLF & _ "" & @CRLF & _ "78 cosa nf thing" & @CRLF & _ "• estoy ya interesado en otra cosa" & @CRLF & _ "100 | 23943 +o" & @CRLF & _ "" & @CRLF & _ "79 tanto adj so much, so many" & @CRLF & _ "• no podía creer que haya tanta gente junta" & @CRLF & _ "100 | 20531" & @CRLF & _ "" & @CRLF & _ "80 hombre nm man, mankind, husband" & @CRLF & _ "• yo soy un hombre de pocas necesidades" & @CRLF & _ "100 | 20292" & @CRLF & _ "" & @CRLF & _ "81 parecer v to seem, look like" & @CRLF & _ "• parecía dormir, tan inmóvil estaba" & @CRLF & _ "100 | 19964" & @CRLF & _ "" & @CRLF & _ "82 nuestro adj our" & @CRLF & _ "• no servía para nuestro país porque somos" & @CRLF & _ "diferentes" & @CRLF & _ "100 | 20666" & @CRLF & _ "" & @CRLF & _ "83 tan adv such, as, too, so" & @CRLF & _ "• en esa mujer está todo; y por eso es tan" & @CRLF & _ "maravillosa" & @CRLF & _ "100 | 19002" & @CRLF & _ "" & @CRLF & _ "84 donde conj where" & @CRLF & _ "• yo sé donde está la llave" & @CRLF & _ "100 | 18852" & @CRLF & _ "" & @CRLF & _ "85 ahora adv now" & @CRLF & _ "• lo importante ahora es contarte lo que le pasó" & @CRLF & _ "100 | 21030 +o" & @CRLF & _ "" & @CRLF & _ "86 parte nf part, portion" & @CRLF & _ "• el arte es una parte tan importante de la" & @CRLF & _ "cultura" & @CRLF & _ "100 | 20319" & @CRLF & _ "" & @CRLF & _ "87 después adv after" & @CRLF & _ "• vamos a dar un paseo después de comer" & @CRLF & _ "100 | 20229" & @CRLF & _ "" & @CRLF & _ "88 vida nf life" & @CRLF & _ "• ha dedicado toda la vida a la música" & @CRLF & _ "100 | 18045" & @CRLF & _ "" & @CRLF & _ "89 quedar v to remain, stay" & @CRLF & _ "• el aire empezó a quedarse quieto" & @CRLF & _ "100 | 18152" & @CRLF & _ "" & @CRLF & _ "90 siempre adv always, forever" & @CRLF & _ "• siempre ha sido así" & @CRLF & _ "100 | 17689" & @CRLF & _ "" & @CRLF & _ "91 creer v to believe, think" & @CRLF & _ "• creo en la justicia de Dios" & @CRLF & _ "100 | 21257 +o" & @CRLF & _ "" & @CRLF & _ "92 hablar v to speak, talk" & @CRLF & _ "• algunos hablan el idioma romaní" & @CRLF & _ "100 | 19006 +o" & @CRLF & _ "" & @CRLF & _ "93 llevar v to take, carry" & @CRLF & _ "• colgado al hombro llevaba un bolso" & @CRLF & _ "100 | 17062" & @CRLF & _ "" & @CRLF & _ "94 dejar v to let, leave" & @CRLF & _ "• ella no dejó que yo lo olvidara" & @CRLF & _ "100 | 18185" & @CRLF & _ "" & @CRLF & _ "95 nada pron nothing, (not) at all" & @CRLF & _ "• no hay nada que hacer" & @CRLF & _ "100 | 19365 +o" & @CRLF & _ "" & @CRLF & _ "96 cada adj each, every" & @CRLF & _ "• de aprender cada día un poco más" & @CRLF & _ "100 | 17155" & @CRLF & _ "" & @CRLF & _ "97 seguir v to follow, keep on" & @CRLF & _ "• el calor sofocante que sigue al mediodía" & @CRLF & _ "100 | 16104" & @CRLF & _ "" & @CRLF & _ "98 menos adj less, fewer" & @CRLF & _ "• no vale más ni menos que la anterior" & @CRLF & _ "100 | 15527" & @CRLF & _ "" & @CRLF & _ "99 nuevo adj new" & @CRLF & _ "• marcaba el comienzo de una nueva vida para" & @CRLF & _ "mí" & @CRLF & _ "100 | 17381" & @CRLF & _ "" & @CRLF & _ "100 encontrar v to find" & @CRLF & _ "• encontró un lugar apropiado para instalar la" & @CRLF & _ "sucursal" & @CRLF & _ "100 | 15556" Local $sSubst = "\1\t\2\t\3\t\4\t\n" Local $sResult = StringRegExpReplace($sString, $sRegex, $sSubst) MsgBox($MB_SYSTEMMODAL, "Result", $sResult)

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