Merge pull request #443 from rebeka-catalina/rct/d/NSFW_README_examples

Grouping parentheses instead of capturing parentheses
This commit is contained in:
Hypolite Petovan 2017-11-08 11:45:25 -05:00 committed by GitHub
commit 639a32fe19
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -47,7 +47,25 @@ done with a single regex, which matches all of them:
Another use case could be, that you are simply not
interested in postings about christmas.
/christmas([-_ ]?(tree|time|eve|pudding))?/
/christmas(?:[-_ ]?(?:tree|time|eve|pudding))?/
ATTENTION:
It is absolutely important, that you use grouping
parentheses instead of capturing parentheses!!
Grouping parentheses are:
(?: )
If you use capturing parentheses, which are
( )
it will produce errors and the regex won't work and
at least your targets will not get collapsed.
3)