2016-12-23 15:27 GMT-03:00 Marco van de Voort <mar...@stack.nl>:

> In our previous episode, Graeme Geldenhuys said:
> > For many other things, plain code could be faster, but often a lot more
> > effort and time consuming to implement. Where as you could have written
> > a regex expression in under 10 seconds and accomplish the same task 8
> > lines of code or less - very little effort required.
>
> Writing or even worse, reading/debugging regex is about the most intensive
> effort there is IMHO.
>


Agree that Regex carries an extra mental overhead. This is why i kept away
from it for a long time.

Early this year i needed to use it in one of my projects, so i decided to
bite the bullet and read Mastering Regular Expressions book.

Once you understand the reasoning behind regex, it's a lot less
intimidating.

These days i use eventually

For coincidence, yesterday, i was writing code to parse raw text to extract
some data.

Initially i did manually but when i needed to extract a new field i
realized things would get even worse. Than rewrote with regex.

See diff here: https://www.diffchecker.com/NDDa9gpH

IMO much better.

Not saying that is easy or should be used at will. But once you learn the
basics, regex is a valuable tool.

For debugging i use http://regexr.com/ and rely on unit tests to ensure
correctness

Luiz
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to