[fpc-pascal] How to split file of whitespace separated numbers?
Luiz Americo Pereira Camara
luizamericop at gmail.com
Sat Dec 24 17:36:20 CET 2016
2016-12-23 15:27 GMT-03:00 Marco van de Voort <marcov at 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
These days i use eventually
For coincidence, yesterday, i was writing code to parse raw text to extract
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal