3 ms·
A bit hyperbolic, no? If you consider it "the weirdest ever", I'm guessing that I'm probably older than you. I've certainly been using regex long before PCRE
by derriz 3y ago
A bit hyperbolic, no?
If you consider it "the weirdest ever", I'm guessing that I'm probably older than you. I've certainly been using regex long before PCRE became common.
As a vim user I compose 10s if not 100s of regexes a day. It does not use PCRE. Nor does sed, a tool I've been using for decades. Do you also recommend not using these?
- comex 3y agoI use all of those tools but the inconsistency drives me crazy as it's hard to remember which syntax to use where. Here's how to match the end of a word: ripgrep, Python, JavaScript, and practically every other non-C language: \b vim: \> BSD sed: [[:>:]] GNU sed, GNU grep: \> or \b BSD grep: \>, \b, or [[:>:]] less: depends on the OS it's running on
- burntsushi 3y agoDid you know that not all of those use the same definition of what a "word" character is? Regex engines differ on the inclusion of things like \p{Join_Control}, \p{Mark} and \p{Connector_Puncuation}. Although in the case of \p{Connector_Punctuation}, regex engines will usually at least include underscore. See: https://github.com/BurntSushi/rebar/blob/f9a4f5c9efda069e7986a262efe8649aa78c0933/benchmarks/definitions/test/unicode/word-boundary.toml https://github.com/BurntSushi/rebar/blob/f9a4f5c9efda069e798... And then there's \p{Letter}. It can be spelled in a lot of ways: \pL, \p{L}, \p{Letter}, \p{gc=Letter}, \p{gc:Letter}, \p{LeTtEr}. All equivalent. Very few regex engines support all of them. Several support \p{L} but not \pL. See: https://github.com/BurntSushi/rebar/blob/f9a4f5c9efda069e7986a262efe8649aa78c0933/benchmarks/definitions/test/unicode/letter.toml https://github.com/BurntSushi/rebar/blob/f9a4f5c9efda069e798...