Use grouping.
foo.*?(foo)
More Related Contents:
- Greedy vs. Reluctant vs. Possessive Qualifiers
- RegEx: Grabbing values between quotation marks
- Regular Expression to match valid dates
- How to match numbers between X and Y with regexp?
- Regex for Comma delimited list
- What’s the regular expression that matches a square bracket?
- How does the regular expression ‘(?
- Regex AND operator
- Oracle 11g get all matched occurrences by a regular expression
- Unicode Regex; Invalid XML characters
- Microsoft office Access `LIKE` VS `RegEx`
- What regular expression can never match?
- Regular Expression Validation For Indian Phone Number and Mobile number
- htaccess force https and redirect www to non-www, but no other subdomains
- Filtering a diff with a regular expression
- Regular Expression for getting everything after last slash [duplicate]
- Create regex from glob expression
- Regex: Get Filename Without Extension in One Shot?
- What is the most correct regular expression for a UNIX file path?
- Grep and regex – why am I escaping curly braces?
- Replace first occurrence of “:” but not second in R
- Multiline Regex in PowerShell
- Powershell script to remove double quotes from CSV unless comma exists inside double quotes
- How to use different separators (/ , |) in a regular expression
- Counting number of occurrences of a string inside another (Perl)
- grep regex whitespace behavior
- Shortest match in regex from end
- RegEx – Match Numbers of Variable Length
- How to replace a string in an existing file in Perl
- Regex – Find all matching words that don’t begin with a specific prefix