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

/
/
smg

Test String

Substitution

Processing...

Code Generator

Generated Code

re = /^(\d+\)\s*\d+\.\s+)(.*?) ISSN/m str = '6) 6. ACROSS LANGUAGES AND CULTURES Semiannual ISSN: 1585-1923 AKADEMIAI KIADO ZRT, BUDAFOKI UT 187-189-A-3, BUDAPEST, HUNGARY, H-1117 Social Sciences Citation Index Arts & Humanities Citation Index 7) 7. ACTA ANALYTICA-INTERNATIONAL PERIODICAL FOR PHILOSOPHY IN THE ANALYTICAL TR ADITION Quarterly ISSN: 0353-5150 SPRINGER, 233 SPRING ST, NEW YORK, USA, NY, 10013 Arts & Humanities Citation Index 8) 8. ACTA ARCHAEOLOGICA Annual ISSN: 0065-101X WILEY, 111 RIVER ST, HOBOKEN, USA, NJ, 07030-5774 Arts & Humanities Citation Index 9) 9. ACTA BOREALIA Semiannual ISSN: 0800-3831 ROUTLEDGE JOURNALS, TAYLOR & FRANCIS LTD, 2-4 PARK SQUARE, MILTON PARK, ABINGDON, ENGLAND, OXON, OX14 4RN Arts & Humanities Citation Index 10) 10. ACTA CLASSICA Annual ISSN: 0065-1141 UNIV FREE STATE, DEPT ENG CLASSICAL LANG, PO BOX 339, BLOEMFONTEIN, SOUTH AFRICA, 9300 Arts & Humanities Citation Index 11) 11. ACTA HISTORICA TALLINNENSIA Annual ISSN: 1406-2925 ESTONIAN ACADEMY PUBLISHERS, 6 KOHTU, TALLINN, ESTONIA, 10130 Arts & Humanities Citation Index 12) 12. ACTA HISTRIAE Tri-annual ISSN: 1318-0185 4 تاریخ انتشار: 89/2/62 پژوهشگاه و شبکه آزمایشگاهی 98/3 :Code UNIV PRIMORSKA, SCI RES CENTRE KOPER, GARIBALDIJEVA 1, KOPER, SLOVENIA, CAPODISTRIA, SI-6000 Social Sciences Citation Index Arts & Humanities Citation Index 13) 13. ACTA KOREANA Semiannual ISSN: 1520-7412 ACADEMIA KOREANA KEIMYUNG UNIV, 1095 DALGUBEOLDAERO, DALSEO-GU, DAEGU, SOUTH KOREA, 704-701 Arts & Humanities Citation Index Current Contents - Arts & Humanities 14) 14. ACTA LINGUISTICA HUNGARICA Quarterly ISSN: 1216-8076 AKADEMIAI KIADO ZRT, BUDAFOKI UT 187-189-A-3, BUDAPEST, HUNGARY, H-1117 Social Sciences Citation Index Arts & Humanities Citation Index 15)15. ACTA LITERARIA Semiannual ISSN: 0717-6848 UNIV CONCEPCION, FAC HUMANIDADES ARTE, CASILLA 160-C, CORREO 3, CONCEPCION, CHILE, 00000 Arts & Humanities Citation Index 16) 16. ACTA MUSICOLOGICA Semiannual ISSN: 0001-6241 INT MUSICOLOGICAL SOC, BOX 561, BASEL, SWITZERLAND, CH-4001 Arts & Humanities Citation Index Current Contents - Arts & Humanities 17) 17. ACTA ORIENTALIA ACADEMIAE SCIENTIARUM HUNGARICAE Quarterly ISSN: 1588-2667 AKADEMIAI KIADO ZRT, BUDAFOKI UT 187-189-A-3, BUDAPEST, HUNGARY, H-1117 Arts & Humanities Citation Index 5 تاریخ انتشار: 89/2/62 پژوهشگاه و شبکه آزمایشگاهی 98/3 :Code Current Contents - Arts & Humanities 18) 18. ACTA PHILOSOPHICA Semiannual ISSN: 1121-2179 FABRIZIO SERRA EDITORE, PO BOX NO,1, SUCC NO. 8, PISA, ITALY, I-56123 Arts & Humanities Citation Index Current Contents - Arts & Humanities' subst = '' result = str.gsub(re, subst) # Print the result of the substitution puts result

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