My Favorite Question
This is the question I had the most fun answering so far. It's a simple but really effective regex technique that can be used in a surprisingly large number of situations.
Tricks / Answers I had fun with
- Match Any English ASCII Character Including Special Characters
- What's in a
$? It depends!
- Matching between Variable Delimiters: Use a Conditional
- One Set of Parentheses, One Group Number: Branch Reset
- At which position in the string did the regex fail?
- Match all possible groups of one to four words
and friends: So you thought matching brackets was easy?
- Match Partially Duplicated lines
- Refactor a Regex with Subroutines
- Regex for nested (overlapping) matches
- Regex Calculators (RPN and non-RPN)
- Match the last group of (potentially) nested brackets
- Reverse-engineer regex pattern to find number of tokens and length of expected matches
- Replace Match with the Number of the Line where it was Found
- Extract All Unique Lines
- Matching French letters
- Capturing Two Optional Groups that Can Occur in Either Order
Answers I loved reading
- What's a number?
- Replacing accented characters
- Options for Forced Failure (ignore the accepted answer). This is just for fun—the standard is
(*F)in Perl and PCRE.
Work in progress—I really want to add more here. By far the greatest thrill I get on Stack is when I read an answer that makes me go "Aha!..." and grasp a way of doing things that is so much more efficient than anything I had come up with. I've been blown away quite a few times. And one thing that's for sure is there's no shortage here of people who are a lot brighter than me. :)
California, Australia or NZ
Member for 3 years, 7 months
1 profile view
Last seen Aug 29 '20 at 17:20