4 ms·
Which is a fancy way to say `grep -iv '^c'`. EDIT: Oh, I missed that the input was a single line. I personally feel that control verbs are bad additions to the
by lifthrasiir 9y ago
Which is a fancy way to say `grep -iv '^c'`. EDIT: Oh, I missed that the input was a single line.
I personally feel that control verbs are bad additions to the regexp, even though I do know that it is not a big addition to the regexp engine itself (e.g. naturally extended from posesssive quantifiers like `a++` or atomic groups `(?>foo)`). Most uses of such verbs can be expressed with combined parsers and simpler regexps, in the much simpler and maintainable way.
- asicsp 9y agosorry, it is not same as `grep -iv '^c'` the `-o` option allows to output only matching portion, the regex is meant to extract all words other than those starting with 'c' or 'C' here's hopefully better example $ # do something with words not surround by quotes $ echo 'I like "mango" and "guava"' | perl -pe 's/"[^"]+"(*SKIP)(*F)|\w+/\U$&/g' I LIKE "mango" AND "guava"
- lifthrasiir 9y agoOh, you are right. I missed that all words are in the same line. That said even the original article mentions that it only moves the captured group to the entire match; I am generally in a position to avoid all uses of control verbs, especially if it only costs one or probably two lines of the additional code that I can fully control and comprehend.