REGEX and Livecode

classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

REGEX and Livecode

Richmond Mathewson-2
Sorry chaps to start a new thread on this, but, somehow lost track of
the last one :(

Having 'swallowed my pride' and accepted that there MIGHT be more to
REGEX than
pattern matching, as I outlined in earlier postings, I had a look at the
URLs various people on the
Use-List provided:

Finding this one fairly thought provoking:
http://www.regular-expressions.info/quickstart.html

My thoughts were provoked in 2 ways:

1. REGEX seems useful.

2. How does one use REGEX within Livecode (and, my inevitable rider;
cross-platform) ?

Because REGEX expressions do NOT seem to be written in whatever name
the RR/LC language is going by at the moment (HyperTalk, MetaTalk,
RevTalk, Transcript,
Revolution. Livecode ???).

Now, as a mono-maniac for Livecode (i.e. I don't use any other
programming languages
on a regular basis) I am only going to go to the bother (and there does
seem to be quite a bit of that)
to learn REGEX if:

1. It can be, somehow, integrated into Livecode.

2. It will serve me better than the way I am doing things at the moment
(pace earlier postings).

Call me "an awkward sausage" if you will; but, I suspect that those
thoughts may, in part at least,
reflect the thoughts of a lot of the "silent masses" who would like to
do all sorts of jolly data
sorting and/or modification with Livecode.

Further to this, I would like to point out this:

http://lessons.runrev.com/s/lessons/m/4603/l/44092-working-with-text

[ admittedly it does not, directly, refer to unicodeText fields; but
that, as I have already found out,
can be dealt with comparatively easily ]

which makes me wonder why one needs to go and "bang one's head against
the wall" of REGEX.

Richmond.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

David C.
On Mon, Dec 31, 2012 at 4:55 AM, Richmond <[hidden email]> wrote:

> Sorry chaps to start a new thread on this, but, somehow lost track of the
> last one :(
>
> Having 'swallowed my pride' and accepted that there MIGHT be more to REGEX
> than
> pattern matching, as I outlined in earlier postings, I had a look at the
> URLs various people on the
> Use-List provided:
>
> Finding this one fairly thought provoking:
> http://www.regular-expressions.info/quickstart.html
>
> My thoughts were provoked in 2 ways:
>
> 1. REGEX seems useful.
>
> 2. How does one use REGEX within Livecode (and, my inevitable rider;
> cross-platform) ?
>
> Because REGEX expressions do NOT seem to be written in whatever name
> the RR/LC language is going by at the moment (HyperTalk, MetaTalk, RevTalk,
> Transcript,
> Revolution. Livecode ???).
>
> Now, as a mono-maniac for Livecode (i.e. I don't use any other programming
> languages
> on a regular basis) I am only going to go to the bother (and there does seem
> to be quite a bit of that)
> to learn REGEX if:
>
> 1. It can be, somehow, integrated into Livecode.
>
> 2. It will serve me better than the way I am doing things at the moment
> (pace earlier postings).
>
> Call me "an awkward sausage" if you will; but, I suspect that those thoughts
> may, in part at least,
> reflect the thoughts of a lot of the "silent masses" who would like to do
> all sorts of jolly data
> sorting and/or modification with Livecode.
>
> Further to this, I would like to point out this:
>
> http://lessons.runrev.com/s/lessons/m/4603/l/44092-working-with-text
>
> [ admittedly it does not, directly, refer to unicodeText fields; but that,
> as I have already found out,
> can be dealt with comparatively easily ]
>
> which makes me wonder why one needs to go and "bang one's head against the
> wall" of REGEX.

Hi Richmond,
RegEx has been incorporated directly into LiveCode since at least the
version 2.5 days which is where I came aboard. There is a very brief
"guide" starting on page 181 of the current Userguide which shows the
usage in LC without any depth for learning RegEx itself.

As to the "why" of RegEx... I can say that in other languages where it
has been incorporated, I've seen some wildly complex, almost mind
boggling text processing done with one single line of RegEx code.

With all of that said, I still personally enjoy (and prefer) the more
often used text processing capabilities of LC, far more than anything
else I've ever tried.

Regards,
David C.

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Richmond Mathewson-2
On 12/31/2012 03:40 PM, David C. wrote:

> On Mon, Dec 31, 2012 at 4:55 AM, Richmond <[hidden email]> wrote:
>> Sorry chaps to start a new thread on this, but, somehow lost track of the
>> last one :(
>>
>> Having 'swallowed my pride' and accepted that there MIGHT be more to REGEX
>> than
>> pattern matching, as I outlined in earlier postings, I had a look at the
>> URLs various people on the
>> Use-List provided:
>>
>> Finding this one fairly thought provoking:
>> http://www.regular-expressions.info/quickstart.html
>>
>> My thoughts were provoked in 2 ways:
>>
>> 1. REGEX seems useful.
>>
>> 2. How does one use REGEX within Livecode (and, my inevitable rider;
>> cross-platform) ?
>>
>> Because REGEX expressions do NOT seem to be written in whatever name
>> the RR/LC language is going by at the moment (HyperTalk, MetaTalk, RevTalk,
>> Transcript,
>> Revolution. Livecode ???).
>>
>> Now, as a mono-maniac for Livecode (i.e. I don't use any other programming
>> languages
>> on a regular basis) I am only going to go to the bother (and there does seem
>> to be quite a bit of that)
>> to learn REGEX if:
>>
>> 1. It can be, somehow, integrated into Livecode.
>>
>> 2. It will serve me better than the way I am doing things at the moment
>> (pace earlier postings).
>>
>> Call me "an awkward sausage" if you will; but, I suspect that those thoughts
>> may, in part at least,
>> reflect the thoughts of a lot of the "silent masses" who would like to do
>> all sorts of jolly data
>> sorting and/or modification with Livecode.
>>
>> Further to this, I would like to point out this:
>>
>> http://lessons.runrev.com/s/lessons/m/4603/l/44092-working-with-text
>>
>> [ admittedly it does not, directly, refer to unicodeText fields; but that,
>> as I have already found out,
>> can be dealt with comparatively easily ]
>>
>> which makes me wonder why one needs to go and "bang one's head against the
>> wall" of REGEX.
> Hi Richmond,
> RegEx has been incorporated directly into LiveCode since at least the
> version 2.5 days which is where I came aboard.

Hey! I missed something, again! Well, well, well :)

> There is a very brief
> "guide" starting on page 181 of the current Userguide which shows the
> usage in LC without any depth for learning RegEx itself.
>
> As to the "why" of RegEx... I can say that in other languages where it
> has been incorporated, I've seen some wildly complex, almost mind
> boggling text processing done with one single line of RegEx code.
>
> With all of that said, I still personally enjoy (and prefer) the more
> often used text processing capabilities of LC, far more than anything
> else I've ever tried.

Having looked briefly at REGEX I am inclined to agree, and would
only use it if I couldn't work out another way round something.

Wishing you (and everybody else on the Use-List) a Happy New Year untroubled
with the niceties of stuff like REGEX!

Richmond.

>
> Regards,
> David C.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Robert Sneidar
In reply to this post by Richmond Mathewson-2
One of the reasons Regex is useful is a lot of SQL implementations support it. I suppose in theory at least, anything you can do with Regex, you can write a function to do in Livecode, but I am not so sure you could say the opposite. It really comes down to this. There are simple one liner Regex commands that are not too difficult, that would take conditional statements inside a loop in livecode to accomplish. Someone already familiar with Regex would probably prefer Regex in that case.

> Because REGEX expressions do NOT seem to be written in whatever name
> the RR/LC language is going by at the moment (HyperTalk, MetaTalk, RevTalk, Transcript,
> Revolution. Livecode ???).

We should just start calling it RadScript and be done with it. That might get the attention of the younger crowd.

Bob


On Dec 31, 2012, at 2:55 AM, Richmond wrote:

> Sorry chaps to start a new thread on this, but, somehow lost track of the last one :(
>
> Having 'swallowed my pride' and accepted that there MIGHT be more to REGEX than
> pattern matching, as I outlined in earlier postings, I had a look at the URLs various people on the
> Use-List provided:
>
> Finding this one fairly thought provoking: http://www.regular-expressions.info/quickstart.html
>
> My thoughts were provoked in 2 ways:
>
> 1. REGEX seems useful.
>
> 2. How does one use REGEX within Livecode (and, my inevitable rider; cross-platform) ?
>
>
> Now, as a mono-maniac for Livecode (i.e. I don't use any other programming languages
> on a regular basis) I am only going to go to the bother (and there does seem to be quite a bit of that)
> to learn REGEX if:
>
> 1. It can be, somehow, integrated into Livecode.
>
> 2. It will serve me better than the way I am doing things at the moment (pace earlier postings).
>
> Call me "an awkward sausage" if you will; but, I suspect that those thoughts may, in part at least,
> reflect the thoughts of a lot of the "silent masses" who would like to do all sorts of jolly data
> sorting and/or modification with Livecode.
>
> Further to this, I would like to point out this:
>
> http://lessons.runrev.com/s/lessons/m/4603/l/44092-working-with-text
>
> [ admittedly it does not, directly, refer to unicodeText fields; but that, as I have already found out,
> can be dealt with comparatively easily ]
>
> which makes me wonder why one needs to go and "bang one's head against the wall" of REGEX.
>
> Richmond.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Kay C Lan
In reply to this post by Richmond Mathewson-2
Read the LC Dictionary entry for matchText. Regex IS already implemented in
LC, if you care to use it. More importantly to you, as the dictionary
states, it is PCRE library compatible, which to me means it is OS agnostic.

All you need to do is learn the syntax (admittedly not trivial for some of
the problems you have posed - and possibly not possible) and then sit back
and let LC do the rest.

HTH

On Mon, Dec 31, 2012 at 6:55 PM, Richmond <[hidden email]>wrote:

> Sorry chaps to start a new thread on this, but, somehow lost track of the
> last one :(
>
> Having 'swallowed my pride' and accepted that there MIGHT be more to REGEX
> than
> pattern matching, as I outlined in earlier postings, I had a look at the
> URLs various people on the
> Use-List provided:
>
> Finding this one fairly thought provoking: http://www.regular-**
> expressions.info/quickstart.**html<http://www.regular-expressions.info/quickstart.html>
>
> My thoughts were provoked in 2 ways:
>
> 1. REGEX seems useful.
>
> 2. How does one use REGEX within Livecode (and, my inevitable rider;
> cross-platform) ?
>
> Because REGEX expressions do NOT seem to be written in whatever name
> the RR/LC language is going by at the moment (HyperTalk, MetaTalk,
> RevTalk, Transcript,
> Revolution. Livecode ???).
>
> Now, as a mono-maniac for Livecode (i.e. I don't use any other programming
> languages
> on a regular basis) I am only going to go to the bother (and there does
> seem to be quite a bit of that)
> to learn REGEX if:
>
> 1. It can be, somehow, integrated into Livecode.
>
> 2. It will serve me better than the way I am doing things at the moment
> (pace earlier postings).
>
> Call me "an awkward sausage" if you will; but, I suspect that those
> thoughts may, in part at least,
> reflect the thoughts of a lot of the "silent masses" who would like to do
> all sorts of jolly data
> sorting and/or modification with Livecode.
>
> Further to this, I would like to point out this:
>
> http://lessons.runrev.com/s/**lessons/m/4603/l/44092-**working-with-text<http://lessons.runrev.com/s/lessons/m/4603/l/44092-working-with-text>
>
> [ admittedly it does not, directly, refer to unicodeText fields; but that,
> as I have already found out,
> can be dealt with comparatively easily ]
>
> which makes me wonder why one needs to go and "bang one's head against the
> wall" of REGEX.
>
> Richmond.
>
> ______________________________**_________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/**mailman/listinfo/use-livecode<http://lists.runrev.com/mailman/listinfo/use-livecode>
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Peter Alcibiades
In reply to this post by Richmond Mathewson-2
The way to think about regex is a bit different for a linux user.  If you have stuff to do involving heavy text manipulation - finding, substituting, rearranging, then you need to know regex.  It makes life much simpler, you can do things at the command line that you would otherwise have to write real programs to do.

But the way to approach it in linux is through sed and awk.  Awk in particular is really worth mastering even if you only use it as an extension of the command line. It can be much more, but if that's all you use it for, its still invaluable.

Grep is also worth finding out about.  You want to find all files in a given directory with a certain string in them, but you want to be a bit vague about exactly what this string is.  Grep -R will do it, but you need a regex to search for to get the right degree of vagueness.

I recently had to establish whether a given file had been deleted and placed in an archive for subsequent use.  The archive had several thousand entries.  Grep -R did it in a few minutes with one command.  Pipe what you find to something suitable, and away you go.
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Peter Alcibiades
In reply to this post by Richmond Mathewson-2
Richmond, also have a look at txt2regex and regexxer.  Should be in the repositories.

Peter
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Richmond Mathewson-2
On 01/01/2013 08:07 PM, Peter Alcibiades wrote:
> Richmond, also have a look at txt2regex and regexxer.  Should be in the
> repositories.

To be honest, I can't be bothered, having worked out how to do all that
is necessary for string manipulation
without having to go near it.

>
> Peter
>
>
>
> --
> View this message in context: http://runtime-revolution.278305.n4.nabble.com/REGEX-and-Livecode-tp4658514p4658583.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Peter Haworth
In reply to this post by Peter Alcibiades
Hi Peter,
I'd be interested in looking at these buut not sure what you mean by
"the repositories .  I checked revONline but didn't find either of them
there.
Pete
lcSQL Software <http://www.lcsql.com>


On Tue, Jan 1, 2013 at 10:07 AM, Peter Alcibiades <
[hidden email]> wrote:

> Richmond, also have a look at txt2regex and regexxer.  Should be in the
> repositories.
>
> Peter
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/REGEX-and-Livecode-tp4658514p4658583.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Peter Alcibiades
Its a Linux thing.  Linux is packaged up out of a huge number of components into actual systems known as 'distributions'.  There are probably around 10-15 major distributions, and around 350 in total.  A great many distributions are remixes of major ones for some specific purpose.  Ubuntu is a distribution which originally was a Debian remix.  Other major ones would be Fedora, Suse, Debian, Slackware.  Distrowatch.com carries a complete listing.

The way a package gets into a distribution is that it has 'maintainers'.  So they will take the source code and produce a Debian or Ubuntu package which the core team then accepts for a given release.

When they do that, it goes into the repositories, which are online archives of all the packages.  I don't know about Ubuntu, but Debian probably has some 20-30,000 packages in its repositories.

When you install a package, its not normally a case of get a file and install it.  You use a package manager, of which there are four or five variants.  The usual one for Debian and Ubuntu is Synaptic, but there are others.  Think of them as clients.  

One way to categorize distributions is by how packages are managed.  So you have the 'apt' ones, of which Debian and Ubuntu are examples.  'rpm' derives from Red Hat and Suse and Fedora use it.  If it helps, think of this a bit like email.  Synaptic would be an email client, and there are others.  The underlying system would be a bit like pop3 or some other mail service prototcol.  

You find the package in your package manager and tell it to do the installation.  The package manager then finds all the stuff that it needs (so called 'dependencies') and installs them too, and it normally takes care of putting in menu entries and so on.

You can also manually install packages - in the case of Debian and Ubuntu these will be so called '.deb' packages.  And you can get the source code and compile and install it.  If you do this, you have to take care of dependencies yourself, which can be tedious, and this is why package managers were developed.

So that's what a repository is.  The reason regex is a bit different in the Linux world, which would include Macs, these being derived from Unix, is that they are built into the command line utilties.  That's the essence of Linux at a sophisticated user level.  Of course, you can, and many people do, use it just like Windows or OSX, in which case its just a vehicle to your applications and files via a graphical interface, and you don't even have to realise that there are many different possible desktop environments, login managers and so on.

The real point of Linux however in terms of features is the shell, and the thing about this is that regex is like the air in the shell.  Its all around and being used all the time, and is accessible from anywhere.  Any Linux editor will support them.  Geany is what I use, but Kate is another.  This is why I suggested awk to Richmond.  Awk and Sed are old fashioned text manipulation utilties which are built into all Linux distributions - and txt2regex and regexxer are going to be in almost all the major repositories.  If you need to hack around with text, the easiest and quickest way is to use the tools that have evolved to do it.  They've evolved over 30+years in the hands of very bright and impatient people who just wanted to get certain jobs done as simply and quickly as possible, so they are really sophisticated and powerful.

Nothing wrong with LiveCode, it does text excellently, but it depends what you are doing and whether you want to just use a command on a file, or actually write a program.  The commands and the way they can be made to interact are just very quick, powerful and flexible ways of doing stuff with text, and after the initial learning curve, they are almost instant.  

A bit longer than I had meant.  If you want to try a distribution, get the xfce version of PCLinuxOS to start.  But Debian is where you will end up.
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

David C.
> ...<snip>The real point of Linux however in terms of features is the shell, and the
> thing about this is that regex is like the air in the shell.  Its all around
> and being used all the time, and is accessible from anywhere.  Any Linux
> editor will support them.  Geany is what I use, but Kate is another.  This
> is why I suggested awk to Richmond.  Awk and Sed are old fashioned text
> manipulation utilties which are built into all Linux distributions - and
> txt2regex and regexxer are going to be in almost all the major repositories.
> If you need to hack around with text, the easiest and quickest way is to use
> the tools that have evolved to do it.  They've evolved over 30+years in the
> hands of very bright and impatient people who just wanted to get certain
> jobs done as simply and quickly as possible, so they are really
> sophisticated and powerful.</snip>

Nice, detailed reply, Peter!
I have a very nice, pristine copy of the original "AWK Programming
Language" book, written by Aho, Kernigan and Weinberger setting just a
few feet away as I type this. Although I have never really taken the
time to wrap my mind around their usage, there really isn't much that
cannot be done in the way of text processing that cannot be handled
with a relative few lines of RegEx, Awk & Sed. Only reason I can think
of for someone to have a need for something different is in the case
where the speed of a compiled executable is needed.

I think without question that they must be the most arcane, yet
powerful programming tools ever devised

Regards,
David C..

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Peter Haworth
In reply to this post by Peter Alcibiades
Thanks Peter.  I'm a Mac guy so not familiar with the Linux terminology,
although I probably have the utilities you mentioned since OSX is Linux at
its core.
Pete
lcSQL Software <http://www.lcsql.com>


On Wed, Jan 2, 2013 at 12:20 AM, Peter Alcibiades <
[hidden email]> wrote:

> Its a Linux thing.  Linux is packaged up out of a huge number of components
> into actual systems known as 'distributions'.  There are probably around
> 10-15 major distributions, and around 350 in total.  A great many
> distributions are remixes of major ones for some specific purpose.  Ubuntu
> is a distribution which originally was a Debian remix.  Other major ones
> would be Fedora, Suse, Debian, Slackware.  Distrowatch.com carries a
> complete listing.
>
> The way a package gets into a distribution is that it has 'maintainers'.
>  So
> they will take the source code and produce a Debian or Ubuntu package which
> the core team then accepts for a given release.
>
> When they do that, it goes into the repositories, which are online archives
> of all the packages.  I don't know about Ubuntu, but Debian probably has
> some 20-30,000 packages in its repositories.
>
> When you install a package, its not normally a case of get a file and
> install it.  You use a package manager, of which there are four or five
> variants.  The usual one for Debian and Ubuntu is Synaptic, but there are
> others.  Think of them as clients.
>
> One way to categorize distributions is by how packages are managed.  So you
> have the 'apt' ones, of which Debian and Ubuntu are examples.  'rpm'
> derives
> from Red Hat and Suse and Fedora use it.  If it helps, think of this a bit
> like email.  Synaptic would be an email client, and there are others.  The
> underlying system would be a bit like pop3 or some other mail service
> prototcol.
>
> You find the package in your package manager and tell it to do the
> installation.  The package manager then finds all the stuff that it needs
> (so called 'dependencies') and installs them too, and it normally takes
> care
> of putting in menu entries and so on.
>
> You can also manually install packages - in the case of Debian and Ubuntu
> these will be so called '.deb' packages.  And you can get the source code
> and compile and install it.  If you do this, you have to take care of
> dependencies yourself, which can be tedious, and this is why package
> managers were developed.
>
> So that's what a repository is.  The reason regex is a bit different in the
> Linux world, which would include Macs, these being derived from Unix, is
> that they are built into the command line utilties.  That's the essence of
> Linux at a sophisticated user level.  Of course, you can, and many people
> do, use it just like Windows or OSX, in which case its just a vehicle to
> your applications and files via a graphical interface, and you don't even
> have to realise that there are many different possible desktop
> environments,
> login managers and so on.
>
> The real point of Linux however in terms of features is the shell, and the
> thing about this is that regex is like the air in the shell.  Its all
> around
> and being used all the time, and is accessible from anywhere.  Any Linux
> editor will support them.  Geany is what I use, but Kate is another.  This
> is why I suggested awk to Richmond.  Awk and Sed are old fashioned text
> manipulation utilties which are built into all Linux distributions - and
> txt2regex and regexxer are going to be in almost all the major
> repositories.
> If you need to hack around with text, the easiest and quickest way is to
> use
> the tools that have evolved to do it.  They've evolved over 30+years in the
> hands of very bright and impatient people who just wanted to get certain
> jobs done as simply and quickly as possible, so they are really
> sophisticated and powerful.
>
> Nothing wrong with LiveCode, it does text excellently, but it depends what
> you are doing and whether you want to just use a command on a file, or
> actually write a program.  The commands and the way they can be made to
> interact are just very quick, powerful and flexible ways of doing stuff
> with
> text, and after the initial learning curve, they are almost instant.
>
> A bit longer than I had meant.  If you want to try a distribution, get the
> xfce version of PCLinuxOS to start.  But Debian is where you will end up.
>
>
>
> --
> View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/REGEX-and-Livecode-tp4658514p4658599.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Robert Sneidar
EEEK! Not anymore. It's full blown UNIX since Tiger if I am not mistaken.

Bob


On Jan 2, 2013, at 11:39 AM, Peter Haworth wrote:

> Thanks Peter.  I'm a Mac guy so not familiar with the Linux terminology,
> although I probably have the utilities you mentioned since OSX is Linux at
> its core.
> Pete
> lcSQL Software <http://www.lcsql.com>


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

pmbrig
In reply to this post by David C.
On Jan 2, 2013, at 6:57 AM, David C. wrote:

> I think without question that they [regex] must be the most arcane, yet
> powerful programming tools ever devised

APL is surely a contender here, eg:

R<-1000
(~RεRº_xR)/R<-1|iR

gives you all the prime numbers less than 1000

(I had to approximate the special symbols that APL uses.) Extremely compact matrix/vector-based mathematical language, quite arcane…. My father worked his whole life in APL, developed an EDI application that is still used commercially. Completely different animal from regex or LC, though, no good for text processing -- AFAIK.

-- Peter

Peter M. Brigham
[hidden email]
http://home.comcast.net/~pmbrig


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Kay C Lan
In reply to this post by Peter Haworth
[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:
http://www.bruji.com/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:
http://www.macupdate.com/app/mac/25327/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.

HTH

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

J. Landman Gay
On 1/2/13 6:55 PM, Kay C Lan wrote:

> As you are on Mac I would highly recommend downloading the free Bwana:
> http://www.bruji.com/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.

Another option is ManOpen, which is similar only it's a standalone
application. It has a menu item for "apropos" which is great because it
lets you search using keywords to find a shell command that fits what
you need.

<http://www.clindberg.org/projects/ManOpen.html>

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Peter Haworth
In reply to this post by Kay C Lan
Thanks Kay, I came across regExhibit a couple of days ago and it's been my
main learning tool.  Before that I was using a very similar tool at
http://www.gskinner.com/RegExr/.  One thing I liked about that is that it
allows you to save regexs with descriptions of what they do

Pete
lcSQL Software <http://www.lcsql.com>


On Wed, Jan 2, 2013 at 4:55 PM, Kay C Lan <[hidden email]> wrote:

> Also, I recommend the free RegExhibit:
> http://www.macupdate.com/app/mac/25327/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.
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Dr. Hawkins
In reply to this post by Peter Haworth
On Wed, Jan 2, 2013 at 11:39 AM, Peter Haworth <[hidden email]> wrote:
> Thanks Peter.  I'm a Mac guy so not familiar with the Linux terminology,
> although I probably have the utilities you mentioned since OSX is Linux at
> its core.

*ack*

No.

Backwards.

It would be fair to call Linux "unix at its core."

Darwin, though, is actual BSD Unix.  "MacOs" is a combination of
Darwin and "minor" details, such as the Mac interface, that run on top
of it.

Linux, in whatever sense you want to take the word, is a
reimplmentation/copy/knockoff/whatever of Unix, not the other way
around.

--
Richard E. Hawkins, Esq.
(702) 508-8462

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Robert Sneidar
From the Linux Wiki:

A 2001 study of Red Hat Linux 7.1 found that this distribution contained 30 million source lines of code. Using the Constructive Cost Model, the study estimated that this distribution required about eight thousand man-years of development time. According to the study, if all this software had been developed by conventional proprietary means, it would have cost about $1.46 billion (2013 US dollars) to develop in the United States.

Initially, no one applied for the trademark for the term Linux, so a guy by the name of William R. Della Croce, Jr. filed for the trademark, then began demanding royalties from everyone that used it. Nice guy. <AhemAssholeCough>

I seem to recall some noise has being made in the past that bits of Linux source was actually copied from Unix source, but I don't think anyone ever actually proved that. At one point, Novell stated that they didn't think that there was any Unix code in the SCO version.

Linus Torvalds has said that if 386BSD had been available at the time, he probably would not have created Linux. The original OS X was built on BSD Unix. I do not think it would at all be fair to call Linux UNIX at it's core, as the Linux kernel was written in C. The Unix kernel was written entirely in assembly language.

Bob


On Jan 3, 2013, at 10:01 PM, Dr. Hawkins wrote:

> On Wed, Jan 2, 2013 at 11:39 AM, Peter Haworth <[hidden email]> wrote:
>> Thanks Peter.  I'm a Mac guy so not familiar with the Linux terminology,
>> although I probably have the utilities you mentioned since OSX is Linux at
>> its core.
>
> *ack*
>
> No.
>
> Backwards.
>
> It would be fair to call Linux "unix at its core."
>
> Darwin, though, is actual BSD Unix.  "MacOs" is a combination of
> Darwin and "minor" details, such as the Mac interface, that run on top
> of it.
>
> Linux, in whatever sense you want to take the word, is a
> reimplmentation/copy/knockoff/whatever of Unix, not the other way
> around.
>
> --
> Richard E. Hawkins, Esq.
> (702) 508-8462
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: REGEX and Livecode

Dr. Hawkins
On Fri, Jan 4, 2013 at 6:50 PM, Robert Sneidar <[hidden email]> wrote:
> I seem to recall some noise has being made in the past that bits of Linux source
>was actually copied from Unix source, but I don't think anyone ever actually proved
>that. At one point, Novell stated that they didn't think that there was any Unix code
>in the SCO version.

I don't think anything ever came of that, no.

> Linus Torvalds has said that if 386BSD had been available at the time, he
>probably would not have created Linux.

I forget the exact sequencing there.  It is a pity that he didn't
stumble across the project (was it still in litigation?  I forget.)


386BSD came from a license to BSD.  AT&T claimed that it had some of
their code in it.  Lawyers made money.  Code replaced.


>The original OS X was built on BSD Unix.

386BSD becomes FreeBSD, which amicably splits into FreeBSD concerned
about just a couple of platforms, and NetBSD, determined to run on
anything with a pmmu and the ability to emulate an FPU. NetBSD then
has a far from amicable split and produces OpenBSD as a splinter,
largely/entirely due to Theo's inability to get along with just about
anyone.  The three share code back and forth quite often.

If I got everything straight, Darwin was drawn primarily from NetBSD,
but modified to use the Mach microkernel like NeXT.  It drew from
other BSD licensed unix, too.  However, it release-syncs to FreeBSD
instead (or at least used to).  Apple apparently fed back plenty of
bug fixe in the process.

OSX then runs on top of Darwin.

> I do not think it would at all be fair to call Linux UNIX at it's core, as the Linux
>kernel was written in C. The Unix kernel was written entirely in assembly language.

40 years ago, on the PDP-8, the predecessor to the PDP-11, on which it
became famous.  The switch to C is *very* early, driven by porting.
Also, there is more than a passing resemblance between C and PDP-11
assembly (and this is not a coincidence.  Snarky folks have been known
to accuse one of being the other).  The unix kernel was C based by the
time Linus was typing.

The Linux kernel was not drawn from the Unix codebase, but certainly
provides the expected functionality of a Unix kernel.  The "at its
core"  bit is more my finding describing a unix as "Linux at its core"
a bit backwards.

I've used both extensively.  FreeBSD is my own preference, but I've
gone back to macs (which remain primarily BSD boxes for me.  But
Spotlight leads to my keeping macos on them.)





--
Richard E. Hawkins, Esq.
(702) 508-8462

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode