3 ms·
What's the trap for this one? I can't think of any engine that parses this to mean anything other than the letters a through z.
by dataflow 1y ago
What's the trap for this one? I can't think of any engine that parses this to mean anything other than the letters a through z.
- dpkirchner 1y agoIt depends on its use, ultimately, but if your goal is to find a string of letters (a common use IMO), you'll want to use something like \p{L} to ensure you don't miss non-ASCII characters. eta: fixed regex, I had typed \L, shared from my faulty memory.
- PhilipRoman 1y agoIn some common implementations if $LANG is set to certain values, it will fail to match some ASCII letters. This is because not all latin character using languages put Z last in the alphabet. Try this (you probably need to enable and generate the locale first) echo y | LANG=lv_LV.UTF-8 grep '[a-z]' Locales in general should be considered a "trap", just look at Windows CSV separator handling, etc.
- 1718627440 1y agoNot in general, but using locales for something different than affecting presentation.
- dataflow 1y agoThat's wild. Thanks for explaining. I had no idea this depends on the locale. Looks like I have about a million scripts to fix...
- accoil 1y ago[A-z] though is a fun one though as it includes a few extra symbols between upper and lowercase.
- 1718627440 1y agoDoes it? I thought Regex are defined on character classes not on numeric ASCII values. What would a Regex do on a different encoding then?