On Sat, Dec 29, 2018 at 8:47 PM Michael Jones <michael.jo...@gmail.com>
wrote:

> Never use a cannon as a fly swatter.
> A regular expression is heavy artillery.
> A for-loop will do just fine: smaller, simpler, faster, land ess
> dependencies:
>

 A +100 to Michael's reply. Before falling in love with Python ~15 years
ago I used Perl for everything that a POSIX shell couldn't handle but which
didn't need the performance provided by C, C++, etc. When I started using
Python I was annoyed that using regexps required more effort. Then I
realized that a lot of the time I was using a regexp was not robust. That
is, likely to fail in unexpected ways.

A regexp is inherently designed to match characters (i.e., Unicode code
points) and not bytes. Even if the locale is ASCII or a ISO 8859 variant.
You should not be using it to match individual bytes unless you have
explicitly set the locale to a single-byte locale (e.g., "C" or "POSIX").

-- 
Kurtis Rader
Caretaker of the exceptional canines Junior and Hank

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to