Working on pattern language
This commit is contained in:
@@ -617,6 +617,8 @@ Don't forget that you're in a programming language and you have other tools at y
|
||||
Instead of creating one complex regular expression, it's often easier to write a series of simpler regexps.
|
||||
If you get stuck trying to create a single regexp that solves your problem, take a step back and think if you could break the problem down into smaller pieces, solving each challenge before moving onto the next one.
|
||||
|
||||
A regular expression is a program that must be written in a single string, and has no debugger, no built-in documentation.
|
||||
|
||||
### Using multiple regular expressions
|
||||
|
||||
When you have complex logical conditions (e.g. match `a` or `b` but not `c` unless `d`) it's often easier to combine multiple `str_detect()` calls with logical operators instead of trying to create a single regular expression.
|
||||
@@ -634,4 +636,3 @@ The results are identical, but I think the first approach is significantly easie
|
||||
If your regular expression gets overly complicated, try breaking it up into smaller pieces, giving each piece a name, and then combining the pieces with logical operations.
|
||||
|
||||
### Repeated `str_replace()`
|
||||
|
||||
|
||||
Reference in New Issue
Block a user