Save & Share

  • Current Version: 1
  • Update Regex
    ctrl+⇧+s
  • Save new Regex
    ctrl+s
  • Add to 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
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]
  • Character class intersection
    [\w&&[^\d]]
  • 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

Code Generator

Generated Code

import re regex = re.compile(r".*images\/(?!cached).*") test_str = ("./images/logos/partners/mastergen.png\n" "./images/logos/partners/highland.png\n" "./images/logos/partners/charollais.png\n" "./images/logos/partners/grasstec.png\n" "./images/logos/partners/stabiliser.png\n" "./images/logos/services\n" "./images/logos/services/farmpay-icon.png\n" "./images/cached\n" "./images/cached/.DS_Store\n" "./images/cached/logo-farmpay-black.png\n" "./images/cached/logo-green-text.svg\n" "./images/cached/readme.md\n" "./images/cached/logo-green-icon.svg\n" "./images/cached/logo-green-icon.png\n" "./images/cached/logo-farmpay-white.png\n" "./images/cached/logo-white-text.svg\n" "./images/cached/logo-green.png\n" "./images/user\n" "./images/user/.DS_Store\n" "./images/user/shield.svg\n" "./images/user/shield-error.svg\n" "./images/user/test-delete.png\n" "./images/user/locked-avatar.png\n" "./images/user/unknown-avatar.png\n" "./images/listing-photo-guides\n" "./images/listing-photo-guides/goats\n" "./images/listing-photo-guides/goats/.DS_Store\n" "./images/listing-photo-guides/goats/bad\n" "./images/listing-photo-guides/goats/bad/1.png\n" "./images/listing-photo-guides/goats/good\n" "./images/listing-photo-guides/goats/good/1.png\n" "./images/listing-photo-guides/pigs\n" "./images/listing-photo-guides/pigs/.DS_Store\n" "./images/listing-photo-guides/pigs/bad\n" "./images/listing-photo-guides/pigs/bad/2.png\n" "./images/listing-photo-guides/pigs/bad/1.png\n" "./images/listing-photo-guides/pigs/good\n" "./images/listing-photo-guides/pigs/good/2.png\n" "./images/listing-photo-guides/pigs/good/1.png\n" "./images/listing-photo-guides/.DS_Store\n" "./images/listing-photo-guides/dairy-cattle\n" "./images/listing-photo-guides/dairy-cattle/.DS_Store\n" "images/listing-photo-guides/dairy-cattle/bad\n" "./images/listing-photo-guides/dairy-cattle/bad/2.png\n" "./images/listing-photo-guides/dairy-cattle/bad/3.png\n" "./images/listing-photo-guides/dairy-cattle/bad/1.png\n" "./images/listing-photo-guides/dairy-cattle/good\n" "./images/listing-photo-guides/dairy-cattle/good/2.png\n" "./images/listing-photo-guides/dairy-cattle/good/3.png\n" "./images/listing-photo-guides/dairy-cattle/good/1.png\n" "./images/listing-photo-guides/sheep\n" "./images/listing-photo-guides/sheep/.DS_Store\n" "./images/listing-photo-guides/sheep/bad\n" "./images/listing-photo-guides/sheep/bad/4.png\n" "./images/listing-photo-guides/sheep/bad/2.png\n" "./images/listing-photo-guides/sheep/bad/3.png\n" "./images/listing-photo-guides/sheep/bad/1.png\n" "./images/listing-photo-guides/sheep/good\n" "./images/listing-photo-guides/sheep/good/4.png\n" "./images/listing-photo-guides/sheep/good/2.png\n" "./images/listing-photo-guides/sheep/good/3.png\n" "./images/listing-photo-guides/sheep/good/1.png\n" "./images/listing-photo-guides/breeding-cattle\n" "./images/listing-photo-guides/breeding-cattle/.DS_Store\n" "./images/listing-photo-guides/breeding-cattle/bad\n" "./images/listing-photo-guides/breeding-cattle/bad/4.png\n" "./images/listing-photo-guides/breeding-cattle/bad/2.png\n" "./images/listing-photo-guides/breeding-cattle/bad/3.png\n" "./images/listing-photo-guides/breeding-cattle/bad/1.png\n" "./images/listing-photo-guides/breeding-cattle/good\n" "./images/listing-photo-guides/breeding-cattle/good/4.png\n" "./images/listing-photo-guides/breeding-cattle/good/2.png\n" "./images/listing-photo-guides/breeding-cattle/good/3.png\n" "./images/listing-photo-guides/breeding-cattle/good/1.png\n" "./images/listing-photo-guides/store-cattle\n" "./images/listing-photo-guides/store-cattle/.DS_Store\n" "./images/listing-photo-guides/store-cattle/bad\n" "./images/listing-photo-guides/store-cattle/bad/2.png\n" "./images/listing-photo-guides/store-cattle/bad/1.png\n" "./images/listing-photo-guides/store-cattle/good\n" "./images/listing-photo-guides/store-cattle/good/2.png\n" "./images/listing-photo-guides/store-cattle/good/1.png\n" "./images/backgrounds\n" "./images/backgrounds/auctions.jpg\n" "./images/backgrounds/family-cows.jpg\n" "./images/backgrounds/tablet-livestock.jpg\n" "./images/backgrounds/dna-strand.jpg\n" "./images/backgrounds/apps.jpg\n" "./images/backgrounds/.DS_Store\n" "./images/backgrounds/handshake-livestock.jpg\n" "./images/backgrounds/cows.jpg\n" "./images/backgrounds/sheep.jpg\n" "./images/backgrounds/premium-seller.jpg\n" "./images/backgrounds/handshake-trade.jpg\n" "./images/backgrounds/haulage-trailer.jpg\n" "./images/backgrounds/uk-map.png\n" "./images/backgrounds/vet.jpg\n" "./images/team\n" "./images/team/kate-jones.jpg\n" "./images/team/michelle-shores.jpg\n" "./images/team/dan-luff.jpg\n" "./images/team/.DS_Store\n" "./images/team/sam-scott.jpg\n" "./images/team/andrew-loftus.jpg\n" "./images/team/ben-stanley.jpg\n" "./images/team/rosie-hetherington.jpg\n" "./images/team/derek-lewis.jpg\n" "./images/team/peter-ellis.jpg\n" "./images/team/andrew-huxham.jpg\n" "./images/team/alex-crooks.jpg\n" "./images/team/bertie-steggles.jpg\n" "./images/team/jamie-mcinnes.jpg\n" "./images/team/patrick-bidwell.jpg\n" "./images/team/dave-rose.jpg\n" "./images/team/becky-smith.jpg\n" "./images/team/andrew-connon.jpg\n" "./images/team/karen-johnson.jpg\n" "./scss\n" "./scss/config\n" "./scss/config/_variables.scss\n" "./scss/vendor.scss\n" "./scss/components\n" "./scss/components/blog.scss\n" "./scss/components/button.scss\n" "./scss/components/table.scss\n" "./scss/components/forms.scss\n" "./scss/components/layout.scss\n" "./scss/components/tag.scss\n" "./scss/components/tooltip.scss\n" "./scss/components/typography.scss\n" "./scss/components/animations.scss\n" "./scss/components/utility.scss\n" "./scss/components/loading.scss\n" "./scss/app.scss\n" "./native-app\n" "./native-app/generated\n" "./native-app/generated/.DS_Store\n" "./native-app/generated/ios\n" "./native-app/generated/ios/splash\n" "./native-app/generated/ios/splash/Default-568h@2x~") matches = regex.finditer(test_str) for match_num, match in enumerate(matches, start=1): print(f"Match {match_num} was found at {match.start()}-{match.end()}: {match.group()}") for group_num, group in enumerate(match.groups(), start=1): print(f"Group {group_num} found at {match.start(group_num)}-{match.end(group_num)}: {group}")

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 Python, please visit: https://docs.python.org/3/library/re.html