Regular Expressions 101

Save & Share

  • Regex Version: ver. 3
  • 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
No Match

/
/
g

Test String

Code Generator

Generated Code

const regex = /(\d+\.\s)/g; // Alternative syntax using RegExp constructor // const regex = new RegExp('(\\d+\\.\\s)', 'g') const str = `Curious about what's in store for you? Tap into the wisdom of the cosmos now by reading your daily horoscope! 🔮 Want to know what the universe has planned for you? Uncover your celestial forecast by clicking here! 🌠 Feel the pulse of the planets! Dive into your daily horoscope now - the stars are waiting to guide you! 🌟 Align with the stars! Discover the cosmic insights tailored to you by reading your daily horoscope here! 🌌 The secrets of your day are written in the stars. Dare to discover them? Click here for your daily horoscope! ✨ Your zodiac sign holds the key to your day. Unlock its secrets now by reading your daily horoscope here! 🗝️ What do the stars have to say about your destiny today? Find out by clicking here for your daily horoscope! 🌠 Embrace your celestial journey! Navigate your day with confidence by reading your daily horoscope here! 🌌 1. Navigate your cosmic pathway! Tap here to explore your daily horoscope. 🌌 2. Embrace the mysteries of the universe. Uncover your daily horoscope now! 🔮 3. Are you ready to align with the stars? Click here to decode your daily horoscope! 🌠 4. Wondering what the stars have in store for you? Find out by reading your daily horoscope! 🌟 5. Your day, decoded by the stars! Click here to access your daily horoscope. 🌞 6. Illuminate your path with the wisdom of the cosmos! Read your daily horoscope here! ✨ 7. Make the most of your day with stellar guidance! Check out your daily horoscope now! 🌌 8. Unlock the secrets of the skies! Click here to explore your daily horoscope. 🌠 9. Chart your course with the stars! Read your daily horoscope now! 🌟 10. Explore the mysteries of the cosmos. Check out your daily horoscope here! 🌌 11. Ready to step into your destiny? Click here to discover your daily horoscope! 🔮 12. Let the stars be your guide. Uncover your daily horoscope now! 🌠 13. Your celestial journey begins here! Dive into your daily horoscope! 🌞 14. Unleash the power of the zodiac! Discover your daily horoscope here! 🌟 15. Embark on your stellar journey! Tap here for your daily horoscope! 🌌 16. Want to know what the cosmos has in store for you? Find out with your daily horoscope! 🌠 17. The stars hold the key to your day! Unlock it with your daily horoscope! 🔑 18. Take a cosmic snapshot of your day! Check out your daily horoscope here! 🌟 19. Set your course by the stars! Click here to access your daily horoscope! 🌌 20. Navigate the celestial winds! Discover your daily horoscope now! 🌠 21. Your stars, your story! Dive into your daily horoscope here! 🌞 22. Unveil the cosmic curtain! Find out what's in store with your daily horoscope! 🌟 23. The cosmos is calling! Answer with your daily horoscope! 🌌 24. The universe has a message for you! Decode it with your daily horoscope! 🔮 25. Let the planets plot your path! Click here to read your daily horoscope! 🌠 26. The cosmos whispers wisdom to you! Listen by reading your daily horoscope! 🌞 27. Unlock the cosmic code of your day! Check your daily horoscope here! 🌟 28. What does the celestial sphere hold for you? Find out with your daily horoscope! 🌌 29. The secrets of the stars await you! Unveil them with your daily horoscope! 🔮 30. Chart your celestial journey! Click here for your daily horoscope! 🌠 31. Read the stellar script of your day! Access your daily horoscope now! 🌞 32. The zodiac holds the keys to your day. Unlock them with your daily horoscope! 🌟 33. The stars are waiting to guide you! Discover their secrets with your daily horoscope! 🌌 34. What do the heavens have in store for you? Find out by checking your daily horoscope! 🔮 35. Walk your stellar path with confidence! Click here for your daily horoscope! 🌠 36. Uncover the cosmic clues to your day! Read your daily horoscope here! 🌞 37. Let the celestial sphere guide you! Access your daily horoscope now! 🌟 38. Hear the whispers of the cosmos! Click here to explore your daily horoscope! 🌌 39. Want to know what the universe whispers? Discover it with your daily horoscope! 🔮 40. Discover the stellar symphony of your day! Click here for your daily horoscope! 🌠 41. Navigate the zodiac with the stars as your guide! Read your daily horoscope now! 🌞 42. Want a cosmic forecast of your day? Click here to discover your daily horoscope! 🌟 43. What celestial secrets does your day hold? Uncover them with your daily horoscope! 🌌 44. Step into the cosmos! Click here to access your daily horoscope! 🔮 45. Unveil your stellar story! Discover your daily horoscope here! 🌠 46. Curious about the celestial forecast for your day? Find out with your daily horoscope! 🌞 47. Let the cosmos be your guide! Dive into your daily horoscope here! 🌟 48. The stars have a message for you! Decode it with your daily horoscope! 🌌 49. What secrets do the stars hold for you? Find out with your daily horoscope! 🔮 50. Embark on a cosmic journey! Explore your daily horoscope here! 🌠`; // Reset `lastIndex` if this regex is defined globally // regex.lastIndex = 0; let m; while ((m = regex.exec(str)) !== null) { // This is necessary to avoid infinite loops with zero-width matches if (m.index === regex.lastIndex) { regex.lastIndex++; } // The result can be accessed through the `m`-variable. m.forEach((match, groupIndex) => { console.log(`Found match, group ${groupIndex}: ${match}`); }); }

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 JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions