regex: grouping missing from the curriculum
See original GitHub issueWe teach something obscure as lookahead, but not the more often used grouping for the sake of subexpression choice, eg. a(bc|def)g
.
Grouping is indirectly taught for capture groups and lookahead, but plays the same general role in both, capturing or not. So this lesson would fit nicely before that, after character groups.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Regular expressions: some groups missing - Stack Overflow
Capturing groups are indexed from left to right, starting at one. Group zero denotes the entire pattern, so the expression m.group(0) is ...
Read more >Missing part of special group in regular expression - CodeQL
One of the problems with using regular expressions is that almost any sequence of characters is a valid pattern. This means that it...
Read more >Regular Expressions: Regexes in Python (Part 2)
In the above example, the regex on line 1 contains two capturing groups, so re.findall() returns a list of three two-tuples, each containing...
Read more >How to Use Regular Expressions in JavaScript - freeCodeCamp
Regular expressions (regex) are a useful programming tool. They are key to efficient text processing. Knowing how to solve problems using ...
Read more >Regular Expression in Python with Examples | Set 1
A Regular Expressions (RegEx) is a special sequence of characters that uses a search pattern to find a string or set of strings....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, if I wasn’t clear: I believe an extra lesson is in order, right after the OR one. Maybe something like “find all the words that have ‘foo’ or ‘bar’ in them”, just long enough to avoid character-list hacks.
Knock yourself out. 😃