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

/
/

Test String

Code Generator

Generated Code

$re = '/(?xs) (?:\n|^)(?P<track>[^\n·]+)\ ·\ (?P<artist>[^\n]+)\n+ (?P<album>[^\n]+)\n+ (?:℗\s*(?P<release_year>\d{4})[^\n]+\n+)? (?:Released\ on\s*:\s*(?P<release_date>\d{4}-\d{2}-\d{2}))?.+? (\nArtist\s*:\s*(?P<clean_artist>[^\n]+)\n)? .+Auto-generated\ by\ YouTube\.\s*$/'; $str = 'Online purchase or streaming https://brilliant-classics.lnk.to/Elc... More Information: https://www.brilliantclassics.com/art... Artists: Ensemble San Felice, Federico Bardazzi (conductor) Social media: Brilliant Classics Facebook: https://brilliant-classics.lnk.to/Fac... Brilliant Classics Instagram: https://brilliant-classics.lnk.to/Ins... Who were the pilgrims who climbed the treacherously steep mountain to the monastery of Montserrat in northern Spain? And what kind of music would have accompanied their journey? This release imagines Christmas Eve in medieval Catalonia, built around the \'song of the Sibyl\'. The tradition of the singing Sibyl was not unique to Montserrat, but it was covertly practiced there long after it had been outlawed by the Council of Trent in 1575. The Sibyl was a pre-Christian woman who prophesied the coming of Christ; during the Middle Ages, a boy would dress up as the Sibyl and, blindfolded, sing the famous verses, normally in the third nocturn of the Christmas Day matins service. This recording uses the Catalan version of the Sibyl\'s song found in the archives of Barcelona Cathedral. Another Catalan book from the same period, the Llibre Vermell de Montserrat, also informs much of this programme. It would have provided pilgrims with suitably religious music to sing on their approach to the cathedral, rather than secular songs and dances. The additional use of Gregorian chant sets the Cant de la Sibil·la in its original context of the early morning matins, before these were standardised into the Office of Readings. Finally, the addition of a traditional secular Catalan song – which tells the story of the doomed Count Arnau – marks the period in the night when the pious pilgrims, eagerly awaiting the opening of the monastery, would give the floor over to storytellers. This CD is the result of a unique project involving professional and amateur artists. The project was premiered as the first concert of a new annual festival in Florence run by Federico Bardazzi and Alessandra Montali, \'InCanto Armonico\'. Established group Ensemble San Felice, who, under Bardazzi\'s direction, have previously made several successful CDs, were paired with the children\'s choir of the Cathedral of Sarzana, Pueri Cantores, who make up the \'voci bianche\'. Featuring young soprano soloist Chiara Galioto, and performed on period instruments, this recording provides the listener with an enchanting aural portrayal of medieval Catalonia. This fascinating programme attempts to depict an imaginary coming together of pilgrims from various countries on their way to celebrate Christmas Mass at the Catalan monastery of Montserrat, one of the strongest bastions of Christianity in the middle ages. During the Matins on Christmas day a boy dressed up as the Sybil blindfoldedly sang the famous verses from pagan times predicting the coming of Christ and the end of the world (this practice was later forbidden by the Council of Trent). This liturgical drama includes music from the famous Llibre Vermell de Montserrat, Gregorian Chant and the 14th century Barcelona Lectionary. Federico Bardazzi and his vocal and instrumental group use copies of original instruments (based on detailed research). For the vocal parts they use a form of improvisation and ornamentation based on Christian, Arab and Jewish tradition, as was in the culture of the Iberian Peninsula in the middle ages. Tracklist: 00:00:00 Polorum Regina 00:05:01 Los set goyts 00:07:34 Maria Matrem Virginem 00:14:14 Stella splendens 00:17:13 Imperayritz de la ciudad joyosa 00:23:44 El comte Arnau 00:27:55 Ad mortem festinamus 00:30:25 Laudemus Virginem – Splendens ceptigera 00:32:11 Antiphona: Christus natus est nobis – Psalmus 94/95 (Invitatory): Venite exultemus Domino 00:34:40 Benedictio – Lectio – De homilia Sancti Augustini 00:36:21 Responsorium: Verbum caro factum est 00:38:53 Benedictio – Lectio – Sermo Sancti Augustini in die Natalis Domini 00:40:13 El cant de la Sibilla 00:47:11 O Virgo splendens 00:48:49 Cuncti simus concanentes 00:51:49 Ave maris stella Thanks for watching this video by Brilliant Classics, we hope you enjoyed it! Don’t forget to share it and subscribe to our YouTube channel: https://brilliant-classics.lnk.to/You... And visit our channel for the best classical music from the greatest composers like: Bach, Satie, Mozart, Tchaikovsky, Beethoven, Chopin, Haydn, Ravel, Debussy, Vivaldi, Handel, Brahms, Liszt, Schubert, Mendelssohn, Rachmaninoff, Wagner, Handel, Dvorak, Schubert and many more! We upload complete albums, music for relaxing, working, studying, meditating, concentrating, instrumental music, opera, violin, classical piano music, sonatas and more! #BrilliantClassics #Music #Composer #ClassicalMusic #EnsembleSanFelice #Guitar #FedericoBardazzi #Conductor #Pilgrims #ChristmasEve #MedievalCatalonia #SongOfTheSibyl'; preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0); // Print the entire match result var_dump($matches);

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 PHP, please visit: http://php.net/manual/en/ref.pcre.php