REGEX and Livecode

Kay C Lan lan.kc.macmail at
Wed Jan 2 19:55:50 EST 2013

[Sent again because the first one was too long - too many previous
posts included I guess]

Peter H, Richmond, and anyone else on Mac looking for a stepping stone
into grep, regex and Unix command line tools,

whilst nothing Peter A said was wrong, unless you are only doing
something very minor with grep, the nice thing with LC is that you can
do all that you already know with LC and only venture into Unix
territory when you need to. With LC's shell command basically anything
you can do from the Unix command line you can get LC to do.
Unfortunately in it's raw form it is a blocking command, but normally
anything you need done is so trivial and lightning fast that you
wouldn't notice. The nice thing is LC also provides a way where you
can have pseudo-multi-threading whereby you can 'launch' a Unix
command line tool and have it merrily process away for hours on end in
the background if necessary, whilst the rest of your LC script
continues to process something else.

As you are on Mac I would highly recommend downloading the free Bwana:

This is a simple tool that loads the 'man' pages into Safari - these
are the manual pages for the tools, basically like the LC Dictionary
entries for each command. Download it, start it, and type in 'grep',
you'll see what I mean. Of course most of the time you have no idea
what you are looking for, but I regularly see people mention command
line entries on this List and else where so it peaks my interest and I
simply type in the command they are using and it not only explains
what they are talking about, but lists all the other options which
might include something I can use.

Also, I recommend the free RegExhibit:

It has nice Help documentation, which because I use regex so
infrequently, quickly reminds me of the syntax I need to use. Put some
example data in the bottom pane, start entering your regex syntax in
the top and you'll quickly know if you are on the right track or not.
Also, MOST IMPORTANTLY, LC uses pcregrep NOT the standard Unix grep,
therefore there are differences and so a command that works on the
command line with grep might not function with LC's pcregrep.
RegExhibit on the other hand uses Perl to do it's thing, which is what
the P in pcregrep stands for. So far I've never had a regex pattern
I've tested in RegExhibit not work in LC - and that's what I always
do, build it in RegExhibit and then Copy & Paste into LC.


More information about the use-livecode mailing list