Help with Regex (was Re: Switch, Case and wild-cards?)
Richard Gaskin
ambassador at fourthworld.com
Sun Dec 30 11:33:00 EST 2012
Richmond wrote:
> Maybe I'm missing something (nothing particularly unusual there), but . . .
>
> I don't really "get" REGEX.
>
> And,frankly, why on earth would I, or anyone else for that matter, want
> to read through some awfully long, wordy and obscure load of b*mf about it?
There's nothing regular about "regular expressions", and like so many
things in computing they seem to have come about through a series of
evolutionary steps which may well be characterized as accidents.
But it's the cryptic nature of regex that makes it so useful, providing
a uniquely compact way of handling a vast range of text parsing in ways
that would take many dozens of lines of code to do by any other means.
So whether we like regex or not, it's here to stay, useful and
ubiquitous enough to be worth the learning curve.
That said, being a very generalized subsystem it's often not the fastest
in execution speed in spite of being fast to type.
In many cases, writing a pull-parser or other offset-based function for
a specific need will yield a much faster result than using regex.
The downside of not using regex, though, is the time required to write
such functions every time you need 'em. For performance-critical
operations it's often well worth it, but for less critical routines
regex may be the more productive option.
--
Richard Gaskin
Fourth World
LiveCode training and consulting: http://www.fourthworld.com
Webzine for LiveCode developers: http://www.LiveCodeJournal.com
Follow me on Twitter: http://twitter.com/FourthWorldSys
More information about the use-livecode
mailing list