Re: Standard Library

2014-08-23 Thread Kay C Lan
On Fri, Aug 22, 2014 at 4:32 PM, Thierry Douez th.do...@gmail.com wrote:

 As I said, the problem was:   /
 needed to be:  a \ backslash delimiting the / forward slash.

 Really?

 Mind you trying this simple one which works here
 and without any backslash!

Typical (for me anyway) that worked fine so I thought I'd throw
together a test stack and compare the two and NOW your original grep
worked fine. So I thought maybe it was the message box as as I said,
that's what I originally used to test your grep. But this time around
it worked fine. So I'm left here scratching my head wondering what was
different. Originally I tried a few TAGS and nothing worked until I
inserted the backslash.

 Could you show me in the regular expression docs why
 do we have to escape a slash?

So I looked into this and there is NO requirement to use \ to delimit
the / char in PCRE grep. On further investigation it appears to be a
limitation of the online grep tester which uses the / char to enclose
the grep string so the server knows what you want to test.

So again, thank you for openning my eyes to group naming and branch
reset, as to the rest I appologise for leading you up a garden path
which I have no idea how I stumbled up :-(

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-23 Thread Mark Wieder
Kay-

Friday, August 22, 2014, 11:36:11 PM, you wrote:

 So I looked into this and there is NO requirement to use \ to delimit
 the / char in PCRE grep. On further investigation it appears to be a
 limitation of the online grep tester which uses the / char to enclose
 the grep string so the server knows what you want to test.

Use of the forward slash char (/) is fairly common to delineate
strings, at least in linux/perl circles. Normally any char can be used
so long as it doesn't appear in the strings to be tested or replaced,
but it's very common to see something like

echo day | sed s/day/night/

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-22 Thread Thierry Douez
Kay,

 As I said, the problem was:   /
 needed to be:  a \ backslash delimiting the / forward slash.

Really?

Mind you trying this simple one which works here
and without any backslash!

on mouseUp

   put rtyrtyyrtyryt Hdfdfddfdfdfdf /H qwewqwqe into T

   put (?Ptag[A-Z])[^]*(.*?)/(?P=tag) into RX

   if matchText( T, RX, theTag, theText) then
  put Found:  tag:   theTag  , theText:   theText
   else
  put not found
   end if
end mouseUp


Could you show me in the regular expression docs why
do we have to escape a slash?

I would be very much interested to
have a small stack with the code and the datas
as I'm collecting snippets for a day to make some HowTos..



Kind regards,

Thierry

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-22 Thread Mark Wieder
Thierry-

Friday, August 22, 2014, 1:32:30 AM, you wrote:

 Could you show me in the regular expression docs why
 do we have to escape a slash?

 I would be very much interested to
 have a small stack with the code and the datas
 as I'm collecting snippets for a day to make some HowTos..

I will also verify that all your regex examples work properly.

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-14 Thread Thierry Douez
 Here is a simple one:

put (?Ptag[A-Z][A-Z0-9]*)\b[^]*.*?/(?P=tag) into RX

if matchText( anyHtmlText, RX) then put Get it!


Ok, just received 2 another positives feedback that this regex is valid!
even with the latest LC x.x DP x  versions. So, we are 3 by now.

And please, avoid coming back saying that it doesn't do this or that;
that was not the idea of my first post.

This line of LC+Regex was here just to explain how to use
named groups, nothing more. So focus on:

- (?Ptag...
- (?P=tag)

If you need some experimented LC + Regex coders,
please, feel free to contact me off-list.


 Regex is powerful stuff. LC + regex is just giving your stack extra
 horsepower for free.

I like nice ending stories :)

Be well,

Thierry


Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-13 Thread Thierry Douez
 Thierry Douez  wrote:

 Check capture group naming and branch reset.

 Thanks Thierry, completely unaware of those. A quick play and I
 couldn't get capture group naming to work with LC

Kay,

Here is a simple one:

   put (?Ptag[A-Z][A-Z0-9]*)\b[^]*.*?/(?P=tag) into RX

   if matchText( anyHtmlText, RX) then put Get it!

   put (?Ptag[A-Z][A-Z0-9]*)\b[^]*.*?/((?P=tag)) into RX

   if matchText( anyHtmlText, RX, aTagName) then put Get:   aTagName


Thierry



Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-13 Thread Charles E Buchwald
Hi Thierry,

OK, well, cool But can you help me understand?

Do you mean if I put this in the message box, making the replacements you 
suggest:
put replaceText(abcd,(ab)(cd),\2\1)

I should get:
cdab

Because I get:
\2\1

What am I missing?

Cheers,
- Charles

On 12 Aug 2014, at 11:38 PM, Thierry Douez th.do...@gmail.com wrote:

 Sorry to be a bit more precise, but actually back references *are*
 implemented. You can use them in the pattern matching, as:
   (.)\1
 I let the reader find what's for :)
 
 A regex engine needs 2 input: a text and a pattern matching
 and it returns true or false plus a list (generic word)
 of index if any captures. That's it. Everything else is *not* part
 of the regex engine.
 
 That said, implementing back references in the replacement text
 is and only is the responsability of Livecode engine! (see below)
 
 
 Example:
 I would expect to be able to do this in the message box:
 put replaceText(abcd,(ab)(cd),$2$1)
 and get this:
 cdab
 
 Well, change $1 $2 by \1 and \2 and it will be less Perlish
 plus this syntax is already in use.

--
Charles E. Buchwald
CEO/Director General
Museografica Digital
http://digital.museografica.com

Mac OSX 10.9.4, LC 6.6.2 Commercial

LC Developer Tools: http://buchwald.ca/developer-tools/

Email Notice: http://wp.me/P3aT4d-33


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-13 Thread Thierry Douez
2014-08-13 10:45 GMT+02:00 Charles E Buchwald char...@buchwald.ca:
 Hi Thierry,

 Do you mean if I put this in the message box, making the replacements you 
 suggest:
 put replaceText(abcd,(ab)(cd),\2\1)

 I should get:
 cdab

 Because I get:
 \2\1

 What am I missing?

Umm, well, I was trying to say that this is *not* implemented in Livecode,
and the link to the engine contributor forum was to show that I wanted
to do it a few mmonths ago...

You can use back references in the *pattern matching text*,
but not in the replacement text.

Sounds better?

Thierry

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-13 Thread Thierry Douez
 You can use back references in the *pattern matching text*,
 but not in the replacement text.

Here is one working:

 put replaceText( IILLoovveeRReeggeexx, (.)(?!\1), empty )

Not sure everybody will agree with the result :)

Regards,

Thierry



Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-13 Thread Peter Haworth
On Wed, Aug 13, 2014 at 3:21 AM, Thierry Douez th.do...@gmail.com wrote:

 put replaceText( IILLoovveeRReeggeexx, (.)(?!\1), empty )


Very clever Thierry!  These back references are very useful.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-13 Thread Kay C Lan
On Wed, Aug 13, 2014 at 3:21 PM, Thierry Douez th.do...@gmail.com wrote:
 Here is a simple one:

put (?Ptag[A-Z][A-Z0-9]*)\b[^]*.*?/(?P=tag) into RX

if matchText( anyHtmlText, RX) then put Get it!

Unfortunately not. At first I thought it was because I was using the
msg box which was reporting:
Error description: matchChunk: error in pattern expression
Hint: pattern error

My very first play was with the msg box so I thought I better try in a
real stack but got the same message so I pasted your code into my
favourite online Regex Tester http://regex101.com/#pcre and it
immediately reported an error with an unescaped delimiter. The /
(forward slash) was hilited in red. I placed a \ (backward slash -
regex delimiter) before it and all was well.

Thierry, thank you so much for taking the time to get me sorted out
with this, but it only reinforces my advise to any new or casual user
of regex regarding the above online tester: it wont make you an
expert, or remove the complexity or confusion you may have, but it
will certainly help you: pinpoint your errors, learn as you go, and
get you the expressions you need a whole lot faster than working with
LC + regex alone.

Regex is powerful stuff. LC + regex is just giving your stack extra
horsepower for free.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-13 Thread Thierry Douez
Kay,

put (?Ptag[A-Z][A-Z0-9]*)\b[^]*.*?/(?P=tag) into RX

if matchText( anyHtmlText, RX) then put Get it!

 Unfortunately not.

Just tried it right now and it works!

What system and LC version do you have?

Are you sure the copy/paste didn't spoil the original regex
or what else could be?

You know, I certainly can do mistakes when I'm writting
anything here, as I don't have always enough time
to test the code I write.. Errare humanun est..

I wouldn't certainly not reject Livecode or anything else if anyone
send some lines of code with a typo in it.


 At first I thought it was because I was using the msg box

Sorry, I never use the message box, so can't really say anything
about any code used this way..

 Thierry, thank you so much for taking the time to get me sorted out
 with this, but it only reinforces my advise to any new or casual user
 of regex regarding the above online tester: it wont make you an
 expert, or remove the complexity or confusion you may have, but it
 will certainly help you: pinpoint your errors, learn as you go, and
 get you the expressions you need a whole lot faster than working with
 LC + regex alone.

Well, the missing point is in Livecode you don't have any feedback
for any bad-formed pattern matching :(


 Regex is powerful stuff. LC + regex is just giving your stack extra
 horsepower for free.

Well said.

if you feel so we could exchange our stack if you are interested to
find out what's wrong from your side.

Thierry

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-12 Thread John Craig
Agree - matchText and matchChunk would both benefit from the ability to 
specify an array to fill with matches - we don't always know exactly how 
many will appear ..


http://quality.runrev.com/show_bug.cgi?id=11391


On 12/08/2014 02:12, Peter Haworth wrote:
I've always kinda thought the return variable parm to matchText was a 
little strange as it relies on you knowing how many matches will be 
found in advance. It would be great if the returned variable could be 
an array keyed by the numeric match number, alike the variables you 
can supply to the some of the database functions.



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-12 Thread Peter Haworth
On Tue, Aug 12, 2014 at 1:56 AM, John Craig j...@splash21.com wrote:

 http://quality.runrev.com/show_bug.cgi?id=11391


Thanks John, added this me to the cc list and also added a comment.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-12 Thread Peter Haworth
I've taken to using regex for input data validation, for example, email
addresses, SSN, telephone numbers, URL,even stripping leading/trailing
spaces.  There are various regex libraries online where people have
contributed expressions for those purposes.

I just like the fact that one line of code is all it takes versus however
many repeat loop lines it takes.  I've never checked out the relative speed
of regex vs native LC script but for short amounts of data like that, it
doesn't really matter.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html


On Mon, Aug 11, 2014 at 5:22 AM, Peter M. Brigham pmb...@gmail.com wrote:

 I have very occasionally tried regex and can see that it is very powerful,
 but to me it's also extremely opaque and I've never climbed far up the
 rather steep learning curve. Partly this is because I've found that
 essentially all of the stuff I would need regex for is do-able in native
 LC, whose string manipulation capabilities are marvelous -- and much more
 intuitive for me. Plus, LC is much faster than regex when chewing through
 very large data sets, as long as you remember to repeat for each…

 My two cents.

 -- Peter

 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig

 Just wondering... when someone asks you, 'A penny for your thoughts'
 and you put your two cents in, what happens to the other penny?


 On Aug 9, 2014, at 11:29 PM, JB wrote:

  Thanks for the info about regex.  I bookmarked
  the website and will be using your advice.  I am
  pretty new to regex and even though I’ve spent
  a lot of time researching it you have helped me
  tremendously.
 
  John Balgenorth
 
 
  On Aug 9, 2014, at 8:15 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:
 
  On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
  One of the things I am interested in seeing more handlers
  and examples is regex.  It seems to be a very powerful
  tool with very few LiveCode examples.
 
  The matchChunk and matchText functions are pretty straight forward to
  use, it's building the regex that can be difficult if you don't live
  with it regularly. If what you really need is examples of regex then I
  highly recommend this online regex builder:
 
  http://regex101.com/#pcre
 
  The thing I like about it is that you can choose the 'Flavor' of regex
  it uses, so unlike other online regex builders that use Javascript,
  you can choose the same library that Livecode uses: PCRE. So if it
  works on this site it should work in LC.
 
  Even better, if you click on the Community tab at the top of the page
  it will present you with a list of 100s and 100s of community provided
  examples of regex, explains what they do, and it's as simple as copy
  and paste into your matchChunk or matchText function to test in LC.
 
  I will warn you though of one gotcha that is easy to trip on if you're
  an occasional user of regex + LC. The standard matchText function
  looks like this:
 
  matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)
 
  so any matches within () will be placed in your variable place holder.
 
  In regex the | character is used as OR
 
  so you might be looking for lowercase jpg file names, but you want
  just the name, not the extension:
 
  ([a-z]+)\.jpg  will work, but not if you also have some with a jpeg
 extension.
 
  ([a-z]+.jpeg will work for those, so these could be combined with the
  | identifier:
 
  ([a-z]+)\.jpg|([a-z]+)\.jpeg
 
  Now I appreciate the regex experts will point out there is a much
  better way to solve this problem than using |, but the point of this
  is, if you use | in your regex, and place it in matchText or
  matchChunk, you no longer have a single placeholder, so your matchText
  function has to be amended accordingly:
 
 
 matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)
 
  It is easy, when copying regex off such sites listed above, or
  building your own, and you know you are only finding x number of data
  bites, to assume that that is how many capture variables you need, but
  if OR is used, then you can easily end up needing double or triple the
  number of variables.
 
  Rule of thumb, always count the number of capturing () in the regex
  and ensure you have the same number of allocated capturing variables.
 
  HTH
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode


 ___
 

Re: Standard Library

2014-08-12 Thread Charles E Buchwald
Yes, but just having a more complete implementation of PCRE regex would make a 
big difference.
For example, LC's regex does not include back references.
Having the ability to use (PCRE compliant) back references would, I believe, in 
many case, eliminate the need for that array of matches.
For example

From http://quality.runrev.com/show_bug.cgi?id=12439

 The dictionary says LiveCode implements regular expressions compatible with 
 the PCRE library. Without back references the LC implementation is a rather 
 limited subset of that library.
 
 Example:
 I would expect to be able to do this in the message box:
 put replaceText(abcd,(ab)(cd),$2$1)
 and get this:
 cdab
 
 Instead I have to do this:
 if matchText(abcd,(ab)(cd),var1,var2) then put var2  var1
 
 But this is a trivial example. If either my string to search or my pattern is 
 slightly more complex, then what would be a trivial task with full PCRE 
 compliant regex becomes comparatively complicated in LC.

On 12 Aug 2014, at 3:56 AM, John Craig j...@splash21.com wrote:

 Agree - matchText and matchChunk would both benefit from the ability to 
 specify an array to fill with matches - we don't always know exactly how many 
 will appear ..
 
 http://quality.runrev.com/show_bug.cgi?id=11391
 
 
 On 12/08/2014 02:12, Peter Haworth wrote:
 I've always kinda thought the return variable parm to matchText was a little 
 strange as it relies on you knowing how many matches will be found in 
 advance. It would be great if the returned variable could be an array keyed 
 by the numeric match number, alike the variables you can supply to the some 
 of the database functions.
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

--
Charles E. Buchwald
CEO/Director General
Museografica Digital
http://digital.museografica.com

Mac OSX 10.9.4, LC 6.6.2 Commercial

LC Developer Tools: http://buchwald.ca/developer-tools/

Email Notice: http://wp.me/P3aT4d-33


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-12 Thread Peter Haworth
Good point, that would be a nice enhancement.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html


On Tue, Aug 12, 2014 at 11:51 AM, Charles E Buchwald char...@buchwald.ca
wrote:

 Yes, but just having a more complete implementation of PCRE regex would
 make a big difference.
 For example, LC's regex does not include back references.
 Having the ability to use (PCRE compliant) back references would, I
 believe, in many case, eliminate the need for that array of matches.
 For example

 From http://quality.runrev.com/show_bug.cgi?id=12439

  The dictionary says LiveCode implements regular expressions compatible
 with the PCRE library. Without back references the LC implementation is a
 rather limited subset of that library.
 
  Example:
  I would expect to be able to do this in the message box:
  put replaceText(abcd,(ab)(cd),$2$1)
  and get this:
  cdab
 
  Instead I have to do this:
  if matchText(abcd,(ab)(cd),var1,var2) then put var2  var1
 
  But this is a trivial example. If either my string to search or my
 pattern is slightly more complex, then what would be a trivial task with
 full PCRE compliant regex becomes comparatively complicated in LC.

 On 12 Aug 2014, at 3:56 AM, John Craig j...@splash21.com wrote:

  Agree - matchText and matchChunk would both benefit from the ability to
 specify an array to fill with matches - we don't always know exactly how
 many will appear ..
 
  http://quality.runrev.com/show_bug.cgi?id=11391
 
 
  On 12/08/2014 02:12, Peter Haworth wrote:
  I've always kinda thought the return variable parm to matchText was a
 little strange as it relies on you knowing how many matches will be found
 in advance. It would be great if the returned variable could be an array
 keyed by the numeric match number, alike the variables you can supply to
 the some of the database functions.
 
 
  ___
  use-livecode mailing list
  use-livecode@lists.runrev.com
  Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
  http://lists.runrev.com/mailman/listinfo/use-livecode

 --
 Charles E. Buchwald
 CEO/Director General
 Museografica Digital
 http://digital.museografica.com

 Mac OSX 10.9.4, LC 6.6.2 Commercial

 LC Developer Tools: http://buchwald.ca/developer-tools/

 Email Notice: http://wp.me/P3aT4d-33


 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-12 Thread JB
I see it is powerful and has a good value.  I  use it for some things
already but when it gets to more complex if then else replace code
it is still too complicated for me.

John Balgenorth


On Aug 12, 2014, at 10:11 AM, Peter Haworth p...@lcsql.com wrote:

 I've taken to using regex for input data validation, for example, email
 addresses, SSN, telephone numbers, URL,even stripping leading/trailing
 spaces.  There are various regex libraries online where people have
 contributed expressions for those purposes.
 
 I just like the fact that one line of code is all it takes versus however
 many repeat loop lines it takes.  I've never checked out the relative speed
 of regex vs native LC script but for short amounts of data like that, it
 doesn't really matter.
 
 Pete
 lcSQL Software http://www.lcsql.com
 Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
 SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
 
 
 On Mon, Aug 11, 2014 at 5:22 AM, Peter M. Brigham pmb...@gmail.com wrote:
 
 I have very occasionally tried regex and can see that it is very powerful,
 but to me it's also extremely opaque and I've never climbed far up the
 rather steep learning curve. Partly this is because I've found that
 essentially all of the stuff I would need regex for is do-able in native
 LC, whose string manipulation capabilities are marvelous -- and much more
 intuitive for me. Plus, LC is much faster than regex when chewing through
 very large data sets, as long as you remember to repeat for each…
 
 My two cents.
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 Just wondering... when someone asks you, 'A penny for your thoughts'
 and you put your two cents in, what happens to the other penny?
 
 
 On Aug 9, 2014, at 11:29 PM, JB wrote:
 
 Thanks for the info about regex.  I bookmarked
 the website and will be using your advice.  I am
 pretty new to regex and even though I’ve spent
 a lot of time researching it you have helped me
 tremendously.
 
 John Balgenorth
 
 
 On Aug 9, 2014, at 8:15 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:
 
 On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
 One of the things I am interested in seeing more handlers
 and examples is regex.  It seems to be a very powerful
 tool with very few LiveCode examples.
 
 The matchChunk and matchText functions are pretty straight forward to
 use, it's building the regex that can be difficult if you don't live
 with it regularly. If what you really need is examples of regex then I
 highly recommend this online regex builder:
 
 http://regex101.com/#pcre
 
 The thing I like about it is that you can choose the 'Flavor' of regex
 it uses, so unlike other online regex builders that use Javascript,
 you can choose the same library that Livecode uses: PCRE. So if it
 works on this site it should work in LC.
 
 Even better, if you click on the Community tab at the top of the page
 it will present you with a list of 100s and 100s of community provided
 examples of regex, explains what they do, and it's as simple as copy
 and paste into your matchChunk or matchText function to test in LC.
 
 I will warn you though of one gotcha that is easy to trip on if you're
 an occasional user of regex + LC. The standard matchText function
 looks like this:
 
 matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)
 
 so any matches within () will be placed in your variable place holder.
 
 In regex the | character is used as OR
 
 so you might be looking for lowercase jpg file names, but you want
 just the name, not the extension:
 
 ([a-z]+)\.jpg  will work, but not if you also have some with a jpeg
 extension.
 
 ([a-z]+.jpeg will work for those, so these could be combined with the
 | identifier:
 
 ([a-z]+)\.jpg|([a-z]+)\.jpeg
 
 Now I appreciate the regex experts will point out there is a much
 better way to solve this problem than using |, but the point of this
 is, if you use | in your regex, and place it in matchText or
 matchChunk, you no longer have a single placeholder, so your matchText
 function has to be amended accordingly:
 
 
 matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)
 
 It is easy, when copying regex off such sites listed above, or
 building your own, and you know you are only finding x number of data
 bites, to assume that that is how many capture variables you need, but
 if OR is used, then you can easily end up needing double or triple the
 number of variables.
 
 Rule of thumb, always count the number of capturing () in the regex
 and ensure you have the same number of allocated capturing variables.
 
 HTH
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 
 ___
 use-livecode mailing list
 

Re: Standard Library

2014-08-12 Thread Kay C Lan
On Mon, Aug 11, 2014 at 10:38 PM, Thierry Douez th.do...@gmail.com wrote:

 Check capture group naming and branch reset.

Thanks Thierry, completely unaware of those. A quick play and I
couldn't get capture group naming to work with LC but branch reset I
could, so that is most useful. Still for anyone who is new to regex or
a very occasional user I find http://regex101.com/#pcre very helpful
as the explanation window tells you what each bit of your code will
do, it hilites any unmatched parentheses and tells you exactly how
many capturing groups you've created.

That's what I love so much about LC and this List. LC allows you to
dip your toes in the waters of regex, perl, shell scripting, SQL,
XML... and this List encourages you to wade right in.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-12 Thread Thierry Douez
 Yes, but just having a more complete implementation of PCRE regex would make 
 a big difference.
 For example, LC's regex does not include back references.
 Having the ability to use (PCRE compliant) back references would, I believe, 
 in many case, eliminate the need for that array of matches.
 For example

 The dictionary says LiveCode implements regular expressions compatible with 
 the PCRE library. Without back references the LC implementation is a rather 
 limited subset of that library.

Sorry to be a bit more precise, but actually back references *are*
implemented. You can use them in the pattern matching, as:
   (.)\1
I let the reader find what's for :)

A regex engine needs 2 input: a text and a pattern matching
and it returns true or false plus a list (generic word)
of index if any captures. That's it. Everything else is *not* part
of the regex engine.

That said, implementing back references in the replacement text
is and only is the responsability of Livecode engine! (see below)


 Example:
 I would expect to be able to do this in the message box:
 put replaceText(abcd,(ab)(cd),$2$1)
 and get this:
 cdab

Well, change $1 $2 by \1 and \2 and it will be less Perlish
plus this syntax is already in use.

What a pity you didn't manifest yourself here and at this time:

http://forums.livecode.com/viewtopic.php?f=66t=17412

I dropped all, feeling a bit lonely on this path..


 Instead I have to do this:
 if matchText(abcd,(ab)(cd),var1,var2) then put var2  var1

 But this is a trivial example. If either my string to search or my pattern 
 is slightly more complex, then what would be a trivial task with full PCRE 
 compliant regex becomes comparatively complicated in LC.

Yes, speaking from experience, Perl and Regex are just Wow
and they are fast; yes, fast!
Why do you think I spent so much time developping a
Perl external for Livecode some years ago.

And if you don't believe a French guy, check how geneticians
work  with huge databases and DNA files..

Regards,

Thierry



Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-11 Thread Thierry Douez
2014-08-10 5:15 GMT+02:00
Kay C Lan lan.kc.macm...@gmail.com:

 It is easy, when copying regex off such sites listed above, or
 building your own, and you know you are only finding x number of data
 bites, to assume that that is how many capture variables you need, but
 if OR is used, then you can easily end up needing double or triple the
 number of variables.

 Rule of thumb, always count the number of capturing () in the regex
 and ensure you have the same number of allocated capturing variables.


As one engine contributor brings the PCRE library (regex) up
to date some time ago, it is easy to deal with this:

Check capture group naming and branch reset.

Both are helpful to avoid those kind of errors.

Thierry


Thierry Douez - http://sunny-tdz.com
Maker of sunnYperl - sunnYmidi - sunnYmage

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-11 Thread Peter Haworth
On Mon, Aug 11, 2014 at 7:38 AM, Thierry Douez th.do...@gmail.com wrote:

 As one engine contributor brings the PCRE library (regex) up
 to date some time ago, it is easy to deal with this:

 Check capture group naming and branch reset.

 Both are helpful to avoid those kind of errors.

 Thierry


Thanks for that Thierry, learned something new about regex!

I've always kinda thought the return variable parm to matchText was a
little strange as it relies on you knowing how many matches will be found
in advance.  It would be great if the returned variable could be an array
keyed by the numeric match number, alike the variables you can supply to
the some of the database functions. Only 1 variable required that way and
you can use the keys of the array to get hold of all the matches.

Pete
lcSQL Software http://www.lcsql.com
Home of lcStackBrowser http://www.lcsql.com/lcstackbrowser.html and
SQLiteAdmin http://www.lcsql.com/sqliteadmin.html
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-11 Thread Peter M. Brigham
I have very occasionally tried regex and can see that it is very powerful, but 
to me it's also extremely opaque and I've never climbed far up the rather steep 
learning curve. Partly this is because I've found that essentially all of the 
stuff I would need regex for is do-able in native LC, whose string manipulation 
capabilities are marvelous -- and much more intuitive for me. Plus, LC is much 
faster than regex when chewing through very large data sets, as long as you 
remember to repeat for each…

My two cents.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

Just wondering... when someone asks you, 'A penny for your thoughts'
and you put your two cents in, what happens to the other penny?


On Aug 9, 2014, at 11:29 PM, JB wrote:

 Thanks for the info about regex.  I bookmarked
 the website and will be using your advice.  I am
 pretty new to regex and even though I’ve spent
 a lot of time researching it you have helped me
 tremendously.
 
 John Balgenorth
 
 
 On Aug 9, 2014, at 8:15 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:
 
 On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
 One of the things I am interested in seeing more handlers
 and examples is regex.  It seems to be a very powerful
 tool with very few LiveCode examples.
 
 The matchChunk and matchText functions are pretty straight forward to
 use, it's building the regex that can be difficult if you don't live
 with it regularly. If what you really need is examples of regex then I
 highly recommend this online regex builder:
 
 http://regex101.com/#pcre
 
 The thing I like about it is that you can choose the 'Flavor' of regex
 it uses, so unlike other online regex builders that use Javascript,
 you can choose the same library that Livecode uses: PCRE. So if it
 works on this site it should work in LC.
 
 Even better, if you click on the Community tab at the top of the page
 it will present you with a list of 100s and 100s of community provided
 examples of regex, explains what they do, and it's as simple as copy
 and paste into your matchChunk or matchText function to test in LC.
 
 I will warn you though of one gotcha that is easy to trip on if you're
 an occasional user of regex + LC. The standard matchText function
 looks like this:
 
 matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)
 
 so any matches within () will be placed in your variable place holder.
 
 In regex the | character is used as OR
 
 so you might be looking for lowercase jpg file names, but you want
 just the name, not the extension:
 
 ([a-z]+)\.jpg  will work, but not if you also have some with a jpeg 
 extension.
 
 ([a-z]+.jpeg will work for those, so these could be combined with the
 | identifier:
 
 ([a-z]+)\.jpg|([a-z]+)\.jpeg
 
 Now I appreciate the regex experts will point out there is a much
 better way to solve this problem than using |, but the point of this
 is, if you use | in your regex, and place it in matchText or
 matchChunk, you no longer have a single placeholder, so your matchText
 function has to be amended accordingly:
 
 matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)
 
 It is easy, when copying regex off such sites listed above, or
 building your own, and you know you are only finding x number of data
 bites, to assume that that is how many capture variables you need, but
 if OR is used, then you can easily end up needing double or triple the
 number of variables.
 
 Rule of thumb, always count the number of capturing () in the regex
 and ensure you have the same number of allocated capturing variables.
 
 HTH
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-11 Thread JB
That is nice to know!

I was thinking I would speed up the
longer text processing.  You just did
me a favor and save me a lot of time
plus made it easier and faster by not
using regex for text processing.

I still appreciate the info others gave
because I know I will use regex from
time to time.

John Balgenorth


On Aug 11, 2014, at 5:22 AM, Peter M. Brigham pmb...@gmail.com wrote:

 I have very occasionally tried regex and can see that it is very powerful, 
 but to me it's also extremely opaque and I've never climbed far up the rather 
 steep learning curve. Partly this is because I've found that essentially all 
 of the stuff I would need regex for is do-able in native LC, whose string 
 manipulation capabilities are marvelous -- and much more intuitive for me. 
 Plus, LC is much faster than regex when chewing through very large data sets, 
 as long as you remember to repeat for each…
 
 My two cents.
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 Just wondering... when someone asks you, 'A penny for your thoughts'
 and you put your two cents in, what happens to the other penny?
 
 
 On Aug 9, 2014, at 11:29 PM, JB wrote:
 
 Thanks for the info about regex.  I bookmarked
 the website and will be using your advice.  I am
 pretty new to regex and even though I’ve spent
 a lot of time researching it you have helped me
 tremendously.
 
 John Balgenorth
 
 
 On Aug 9, 2014, at 8:15 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:
 
 On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
 One of the things I am interested in seeing more handlers
 and examples is regex.  It seems to be a very powerful
 tool with very few LiveCode examples.
 
 The matchChunk and matchText functions are pretty straight forward to
 use, it's building the regex that can be difficult if you don't live
 with it regularly. If what you really need is examples of regex then I
 highly recommend this online regex builder:
 
 http://regex101.com/#pcre
 
 The thing I like about it is that you can choose the 'Flavor' of regex
 it uses, so unlike other online regex builders that use Javascript,
 you can choose the same library that Livecode uses: PCRE. So if it
 works on this site it should work in LC.
 
 Even better, if you click on the Community tab at the top of the page
 it will present you with a list of 100s and 100s of community provided
 examples of regex, explains what they do, and it's as simple as copy
 and paste into your matchChunk or matchText function to test in LC.
 
 I will warn you though of one gotcha that is easy to trip on if you're
 an occasional user of regex + LC. The standard matchText function
 looks like this:
 
 matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)
 
 so any matches within () will be placed in your variable place holder.
 
 In regex the | character is used as OR
 
 so you might be looking for lowercase jpg file names, but you want
 just the name, not the extension:
 
 ([a-z]+)\.jpg  will work, but not if you also have some with a jpeg 
 extension.
 
 ([a-z]+.jpeg will work for those, so these could be combined with the
 | identifier:
 
 ([a-z]+)\.jpg|([a-z]+)\.jpeg
 
 Now I appreciate the regex experts will point out there is a much
 better way to solve this problem than using |, but the point of this
 is, if you use | in your regex, and place it in matchText or
 matchChunk, you no longer have a single placeholder, so your matchText
 function has to be amended accordingly:
 
 matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)
 
 It is easy, when copying regex off such sites listed above, or
 building your own, and you know you are only finding x number of data
 bites, to assume that that is how many capture variables you need, but
 if OR is used, then you can easily end up needing double or triple the
 number of variables.
 
 Rule of thumb, always count the number of capturing () in the regex
 and ensure you have the same number of allocated capturing variables.
 
 HTH
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your 
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 

Re: Standard Library

2014-08-11 Thread Alain Farmer
Regex is GREAT! 

I use it a LOT.
Anyone need any help to grasp how it works ?



On Monday, August 11, 2014 10:14:28 PM, JB sund...@pacifier.com wrote:
 


That is nice to know!

I was thinking I would speed up the
longer text processing.  You just did
me a favor and save me a lot of time
plus made it easier and faster by not
using regex for text processing.

I still appreciate the info others gave
because I know I will use regex from
time to time.

John Balgenorth


On Aug 11, 2014, at 5:22 AM, Peter M. Brigham pmb...@gmail.com wrote:

 I have very occasionally tried regex and can see that it is very powerful, 
 but to me it's also extremely opaque and I've never climbed far up the rather 
 steep learning curve. Partly this is because I've found that essentially all 
 of the stuff I would need regex for is do-able in native LC, whose string 
 manipulation capabilities are marvelous -- and much more intuitive for me. 
 Plus, LC is much faster than regex when chewing through very large data sets, 
 as long as you remember to repeat for each…
 
 My two cents.
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 Just wondering... when someone asks you, 'A penny for your thoughts'
 and you put your two cents in, what happens to the other penny?
 
 
 On Aug 9, 2014, at 11:29 PM, JB wrote:
 
 Thanks for the info about regex.  I bookmarked
 the website and will be using your advice.  I am
 pretty new to regex and even though I’ve spent
 a lot of time researching it you have helped me
 tremendously.
 
 John Balgenorth
 
 
 On Aug 9, 2014, at 8:15 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:
 
 On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
 One of the things I am interested in seeing more handlers
 and examples is regex.  It seems to be a very powerful
 tool with very few LiveCode examples.
 
 The matchChunk and matchText functions are pretty straight forward to
 use, it's building the regex that can be difficult if you don't live
 with it regularly. If what you really need is examples of regex then I
 highly recommend this online regex builder:
 
 http://regex101.com/#pcre
 
 The thing I like about it is that you can choose the 'Flavor' of regex
 it uses, so unlike other online regex builders that use Javascript,
 you can choose the same library that Livecode uses: PCRE. So if it
 works on this site it should work in LC.
 
 Even better, if you click on the Community tab at the top of the page
 it will present you with a list of 100s and 100s of community provided
 examples of regex, explains what they do, and it's as simple as copy
 and paste into your matchChunk or matchText function to test in LC.
 
 I will warn you though of one gotcha that is easy to trip on if you're
 an occasional user of regex + LC. The standard matchText function
 looks like this:
 
 matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)
 
 so any matches within () will be placed in your variable place holder.
 
 In regex the | character is used as OR
 
 so you might be looking for lowercase jpg file names, but you want
 just the name, not the extension:
 
 ([a-z]+)\.jpg  will work, but not if you also have some with a jpeg 
 extension.
 
 ([a-z]+.jpeg will work for those, so these could be combined with the
 | identifier:
 
 ([a-z]+)\.jpg|([a-z]+)\.jpeg
 
 Now I appreciate the regex experts will point out there is a much
 better way to solve this problem than using |, but the point of this
 is, if you use | in your regex, and place it in matchText or
 matchChunk, you no longer have a single placeholder, so your matchText
 function has to be amended accordingly:
 
 matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)
 
 It is easy, when copying regex off such sites listed above, or
 building your own, and you know you are only finding x number of data
 bites, to assume that that is how many capture variables you need, but
 if OR is used, then you can easily end up needing double or triple the
 number of variables.
 
 Rule of thumb, always count the number of capturing () in the regex
 and ensure you have the same number of allocated capturing variables.
 
 HTH
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your 
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode

 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 



Re: Standard Library

2014-08-11 Thread JB
I was interested in using a if then replace combination
but it seems it might be better done in LiveCode using
repeat for each.  If the speed is not considerably faster
with regex it is not worth the trouble.  The ability to read
my code like I am used to is more important than a small
increase in speed.

John Balgenorth


On Aug 11, 2014, at 8:03 PM, Alain Farmer alain_far...@yahoo.com wrote:

 Regex is GREAT! 
 
 I use it a LOT.
 Anyone need any help to grasp how it works ?
 
 
 
 On Monday, August 11, 2014 10:14:28 PM, JB sund...@pacifier.com wrote:
 
 
 
 That is nice to know!
 
 I was thinking I would speed up the
 longer text processing.  You just did
 me a favor and save me a lot of time
 plus made it easier and faster by not
 using regex for text processing.
 
 I still appreciate the info others gave
 because I know I will use regex from
 time to time.
 
 John Balgenorth
 
 
 On Aug 11, 2014, at 5:22 AM, Peter M. Brigham pmb...@gmail.com wrote:
 
 I have very occasionally tried regex and can see that it is very powerful, 
 but to me it's also extremely opaque and I've never climbed far up the 
 rather steep learning curve. Partly this is because I've found that 
 essentially all of the stuff I would need regex for is do-able in native LC, 
 whose string manipulation capabilities are marvelous -- and much more 
 intuitive for me. Plus, LC is much faster than regex when chewing through 
 very large data sets, as long as you remember to repeat for each…
 
 My two cents.
 
 -- Peter
 
 Peter M. Brigham
 pmb...@gmail.com
 http://home.comcast.net/~pmbrig
 
 Just wondering... when someone asks you, 'A penny for your thoughts'
 and you put your two cents in, what happens to the other penny?
 
 
 On Aug 9, 2014, at 11:29 PM, JB wrote:
 
 Thanks for the info about regex.  I bookmarked
 the website and will be using your advice.  I am
 pretty new to regex and even though I’ve spent
 a lot of time researching it you have helped me
 tremendously.
 
 John Balgenorth
 
 
 On Aug 9, 2014, at 8:15 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:
 
 On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
 One of the things I am interested in seeing more handlers
 and examples is regex.  It seems to be a very powerful
 tool with very few LiveCode examples.
 
 The matchChunk and matchText functions are pretty straight forward to
 use, it's building the regex that can be difficult if you don't live
 with it regularly. If what you really need is examples of regex then I
 highly recommend this online regex builder:
 
 http://regex101.com/#pcre
 
 The thing I like about it is that you can choose the 'Flavor' of regex
 it uses, so unlike other online regex builders that use Javascript,
 you can choose the same library that Livecode uses: PCRE. So if it
 works on this site it should work in LC.
 
 Even better, if you click on the Community tab at the top of the page
 it will present you with a list of 100s and 100s of community provided
 examples of regex, explains what they do, and it's as simple as copy
 and paste into your matchChunk or matchText function to test in LC.
 
 I will warn you though of one gotcha that is easy to trip on if you're
 an occasional user of regex + LC. The standard matchText function
 looks like this:
 
 matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)
 
 so any matches within () will be placed in your variable place holder.
 
 In regex the | character is used as OR
 
 so you might be looking for lowercase jpg file names, but you want
 just the name, not the extension:
 
 ([a-z]+)\.jpg  will work, but not if you also have some with a jpeg 
 extension.
 
 ([a-z]+.jpeg will work for those, so these could be combined with the
 | identifier:
 
 ([a-z]+)\.jpg|([a-z]+)\.jpeg
 
 Now I appreciate the regex experts will point out there is a much
 better way to solve this problem than using |, but the point of this
 is, if you use | in your regex, and place it in matchText or
 matchChunk, you no longer have a single placeholder, so your matchText
 function has to be amended accordingly:
 
 matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)
 
 It is easy, when copying regex off such sites listed above, or
 building your own, and you know you are only finding x number of data
 bites, to assume that that is how many capture variables you need, but
 if OR is used, then you can easily end up needing double or triple the
 number of variables.
 
 Rule of thumb, always count the number of capturing () in the regex
 and ensure you have the same number of allocated capturing variables.
 
 HTH
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your 
 subscription preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 
 
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit 

Re: Standard Library

2014-08-11 Thread Richard Gaskin

Alain Farmer wrote:

 Regex is GREAT!

 I use it a LOT.
 Anyone need any help to grasp how it works ?

Funny you should ask that - there was a request recently in the forums 
for a RegEx tutorial:


http://forums.livecode.com/viewtopic.php?f=6t=21280

Such a tutorial would be a great addition to the Lessons at LiveCode.com.

--
 Richard Gaskin
 LiveCode Community Manager
 rich...@livecode.org


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-11 Thread JB
It would take a tutorial and one would be
worth reading.

John Balgenorth


On Aug 11, 2014, at 8:27 PM, Richard Gaskin ambassa...@fourthworld.com wrote:

 Alain Farmer wrote:
 
  Regex is GREAT!
 
  I use it a LOT.
  Anyone need any help to grasp how it works ?
 
 Funny you should ask that - there was a request recently in the forums for a 
 RegEx tutorial:
 
 http://forums.livecode.com/viewtopic.php?f=6t=21280
 
 Such a tutorial would be a great addition to the Lessons at LiveCode.com.
 
 -- 
 Richard Gaskin
 LiveCode Community Manager
 rich...@livecode.org
 
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-09 Thread JB
When I am asking about using the code I
do not mean using all of the code I only
mean using small parts of it which would
be what appears it is made for.

John Balgenorth


On Aug 9, 2014, at 5:09 PM, JB sund...@pacifier.com wrote:

 Revolution Standard Library was put together by
 Richard Gaskin and Ken Ray and provides a lot
 of useful handlers.
 
 Is the code allowed to be used in a commercial
 program royalty free and if so what would be the
 proper information to list in the product showing
 it is being used and plus the proper credits.
 
 Has the library been updated recently and if so
 where can it be downloaded?
 
 John Balgenorth
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-09 Thread Richard Gaskin

JB wrote:


Revolution Standard Library was put together by
Richard Gaskin and Ken Ray and provides a lot
of useful handlers.


May I ask which ones you found useful?  It might just motivate me to 
resume the project.



Is the code allowed to be used in a commercial
program royalty free and if so what would be the
proper information to list in the product showing
it is being used and plus the proper credits.


If I recall correctly the intention was to release it under the MIT 
license - MIT is very permissive, and GPL-compatible; commercial work 
definitely allowed, as are proprietary modifications (though it would be 
cool if you chose to enhance anything there and shared it back so we can 
update the master).


May I ask where you stumbled across it?  If we still have that posted 
online we should definitely put a proper license on it.



Has the library been updated recently and if so
where can it be downloaded?


We haven't updated it in a very long time. Both of us have been too busy 
with client projects, and to be honest it was one of those ideas that 
seemed simple enough when we got started, but the more we planned it out 
the more it became clear that to be truly useful it needed to break from 
its original goal as a library into more of a framework.  Frameworks can 
be useful, but they tend to require a MUCH steeper learning curve to 
use, so we weren't sure how many people would be interested.


For example, a lot of the stuff we were doing became dependent on a 
global array called gAppInfo, which made all sorts of other things much 
simpler to sort out (prefs subfolder names, the app name, version info, 
and more could be stored there for one-stop shopping for other handlers 
and even other interoperable tools).  But that meant that you had to be 
sure to initialize that global at the beginning of your app's code.


I like to think of a good library as a collection of discrete handlers, 
in which you can call anything you need but only when you need it, and 
you only need to learn the one you want to use.


Once we start down the road of requiring users to learn all sorts of 
other things to use any of it at all, which worked out fine for Ken and 
I since for whatever odd reason we wound up adopting almost completely 
parallel architectural habits anyway.  But for others to use, it seemed 
like it would get an ever smaller potential audience the deeper we went 
with it, so we've just been working on our own stuff since.


In fact, you're the first person to bring it up in years.  So maybe the 
idea can be resurrected


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-09 Thread JB
Hi Richard,

Thanks for the fast reply.

I was searching for a way to get file info so I could
display things like the size and creation date and
after using google I saw a post that you answered
and you provided the handler to do it.  Eventually
I somehow ended up finding a download but I do
not remember where.  I do know that I downloade
it many years ago so I already had it.

As I mentioned the part I was interested in mainly
was file info so I did not need to use the default
folder to get the info.

Concerning the framework or handlers I definitely
would prefer to use handlers and then I can use
what I want and not use globals.

It seems to me a lot of people probably will eventually
find a need for one or more of these handlers and the
more made available the better off the community will
be.

My use will be simple at this time and will not really be
a modification.  I am going to be using ListMagic to put
the name of a file the user will enter and I wanted to
have the file listed in the same way the finder shows it.

One of the things I am interested in seeing more handlers
and examples is regex.  It seems to be a very powerful
tool with very few LiveCode examples.

Another good idea would be the command line examples.
I was able to get a command line to do what I wanted but
this took many hours and needed s special way of writing
it.  Phil Davis has some examples that show how to access
the manual in the terminal but those examples do not work
with using the command line that I wanted which was xxd.

A question about using command lines is can they be used
in a commercial product and is there any possible reason a
command line that is being used in LiveCode today won’t be
able to be used for some reason or another in the future.  If
so this can cause a complete failure of a good program and
is risky business to say the least.  As for xxd the manual list
the person who wrote it and he states anyone can use it free
of charge but if you make money he would like you to share.
I do not think he wants a royalty on a continuous basis but he
would appreciate a little bit of money.

thanks again,
John Balgenorth


On Aug 9, 2014, at 5:37 PM, Richard Gaskin ambassa...@fourthworld.com wrote:

 JB wrote:
 
 Revolution Standard Library was put together by
 Richard Gaskin and Ken Ray and provides a lot
 of useful handlers.
 
 May I ask which ones you found useful?  It might just motivate me to resume 
 the project.
 
 Is the code allowed to be used in a commercial
 program royalty free and if so what would be the
 proper information to list in the product showing
 it is being used and plus the proper credits.
 
 If I recall correctly the intention was to release it under the MIT license - 
 MIT is very permissive, and GPL-compatible; commercial work definitely 
 allowed, as are proprietary modifications (though it would be cool if you 
 chose to enhance anything there and shared it back so we can update the 
 master).
 
 May I ask where you stumbled across it?  If we still have that posted online 
 we should definitely put a proper license on it.
 
 Has the library been updated recently and if so
 where can it be downloaded?
 
 We haven't updated it in a very long time. Both of us have been too busy with 
 client projects, and to be honest it was one of those ideas that seemed 
 simple enough when we got started, but the more we planned it out the more it 
 became clear that to be truly useful it needed to break from its original 
 goal as a library into more of a framework.  Frameworks can be useful, but 
 they tend to require a MUCH steeper learning curve to use, so we weren't sure 
 how many people would be interested.
 
 For example, a lot of the stuff we were doing became dependent on a global 
 array called gAppInfo, which made all sorts of other things much simpler to 
 sort out (prefs subfolder names, the app name, version info, and more could 
 be stored there for one-stop shopping for other handlers and even other 
 interoperable tools).  But that meant that you had to be sure to initialize 
 that global at the beginning of your app's code.
 
 I like to think of a good library as a collection of discrete handlers, in 
 which you can call anything you need but only when you need it, and you only 
 need to learn the one you want to use.
 
 Once we start down the road of requiring users to learn all sorts of other 
 things to use any of it at all, which worked out fine for Ken and I since for 
 whatever odd reason we wound up adopting almost completely parallel 
 architectural habits anyway.  But for others to use, it seemed like it would 
 get an ever smaller potential audience the deeper we went with it, so we've 
 just been working on our own stuff since.
 
 In fact, you're the first person to bring it up in years.  So maybe the idea 
 can be resurrected
 
 -- 
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 

Re: Standard Library

2014-08-09 Thread Mark Wieder
Richard-

Saturday, August 9, 2014, 5:37:14 PM, you wrote:

 May I ask where you stumbled across it?  If we still have that posted
 online we should definitely put a proper license on it.

It is indeed still online:

https://groups.yahoo.com/neo/groups/revInterop/files/Revolution%20Standard%20Library/

 Has the library been updated recently and if so
 where can it be downloaded?

 We haven't updated it in a very long time.

26 April 2007, to be exact.

-- 
-Mark Wieder
 ahsoftw...@gmail.com

This communication may be unlawfully collected and stored by the National 
Security Agency (NSA) in secret. The parties to this email do not 
consent to the retrieving or storing of this communication and any 
related metadata, as well as printing, copying, re-transmitting, 
disseminating, or otherwise using it. If you believe you have received 
this communication in error, please delete it immediately.


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-09 Thread Kay C Lan
On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
 One of the things I am interested in seeing more handlers
 and examples is regex.  It seems to be a very powerful
 tool with very few LiveCode examples.

The matchChunk and matchText functions are pretty straight forward to
use, it's building the regex that can be difficult if you don't live
with it regularly. If what you really need is examples of regex then I
highly recommend this online regex builder:

http://regex101.com/#pcre

The thing I like about it is that you can choose the 'Flavor' of regex
it uses, so unlike other online regex builders that use Javascript,
you can choose the same library that Livecode uses: PCRE. So if it
works on this site it should work in LC.

Even better, if you click on the Community tab at the top of the page
it will present you with a list of 100s and 100s of community provided
examples of regex, explains what they do, and it's as simple as copy
and paste into your matchChunk or matchText function to test in LC.

I will warn you though of one gotcha that is easy to trip on if you're
an occasional user of regex + LC. The standard matchText function
looks like this:

matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)

so any matches within () will be placed in your variable place holder.

In regex the | character is used as OR

so you might be looking for lowercase jpg file names, but you want
just the name, not the extension:

([a-z]+)\.jpg  will work, but not if you also have some with a jpeg extension.

([a-z]+.jpeg will work for those, so these could be combined with the
| identifier:

([a-z]+)\.jpg|([a-z]+)\.jpeg

Now I appreciate the regex experts will point out there is a much
better way to solve this problem than using |, but the point of this
is, if you use | in your regex, and place it in matchText or
matchChunk, you no longer have a single placeholder, so your matchText
function has to be amended accordingly:

matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)

It is easy, when copying regex off such sites listed above, or
building your own, and you know you are only finding x number of data
bites, to assume that that is how many capture variables you need, but
if OR is used, then you can easily end up needing double or triple the
number of variables.

Rule of thumb, always count the number of capturing () in the regex
and ensure you have the same number of allocated capturing variables.

HTH

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Standard Library

2014-08-09 Thread JB
Thanks for the info about regex.  I bookmarked
the website and will be using your advice.  I am
pretty new to regex and even though I’ve spent
a lot of time researching it you have helped me
tremendously.

John Balgenorth


On Aug 9, 2014, at 8:15 PM, Kay C Lan lan.kc.macm...@gmail.com wrote:

 On Sun, Aug 10, 2014 at 9:08 AM, JB sund...@pacifier.com wrote:
 One of the things I am interested in seeing more handlers
 and examples is regex.  It seems to be a very powerful
 tool with very few LiveCode examples.
 
 The matchChunk and matchText functions are pretty straight forward to
 use, it's building the regex that can be difficult if you don't live
 with it regularly. If what you really need is examples of regex then I
 highly recommend this online regex builder:
 
 http://regex101.com/#pcre
 
 The thing I like about it is that you can choose the 'Flavor' of regex
 it uses, so unlike other online regex builders that use Javascript,
 you can choose the same library that Livecode uses: PCRE. So if it
 works on this site it should work in LC.
 
 Even better, if you click on the Community tab at the top of the page
 it will present you with a list of 100s and 100s of community provided
 examples of regex, explains what they do, and it's as simple as copy
 and paste into your matchChunk or matchText function to test in LC.
 
 I will warn you though of one gotcha that is easy to trip on if you're
 an occasional user of regex + LC. The standard matchText function
 looks like this:
 
 matchTex(yourDataVar,regex(capturethis)expression,yourCapturedVar)
 
 so any matches within () will be placed in your variable place holder.
 
 In regex the | character is used as OR
 
 so you might be looking for lowercase jpg file names, but you want
 just the name, not the extension:
 
 ([a-z]+)\.jpg  will work, but not if you also have some with a jpeg extension.
 
 ([a-z]+.jpeg will work for those, so these could be combined with the
 | identifier:
 
 ([a-z]+)\.jpg|([a-z]+)\.jpeg
 
 Now I appreciate the regex experts will point out there is a much
 better way to solve this problem than using |, but the point of this
 is, if you use | in your regex, and place it in matchText or
 matchChunk, you no longer have a single placeholder, so your matchText
 function has to be amended accordingly:
 
 matchText(yourDataVar,([a-z]+)\.jpg|([a-z]+)\.jpeg,myJpgFile,myJpegFile)
 
 It is easy, when copying regex off such sites listed above, or
 building your own, and you know you are only finding x number of data
 bites, to assume that that is how many capture variables you need, but
 if OR is used, then you can easily end up needing double or triple the
 number of variables.
 
 Rule of thumb, always count the number of capturing () in the regex
 and ensure you have the same number of allocated capturing variables.
 
 HTH
 
 ___
 use-livecode mailing list
 use-livecode@lists.runrev.com
 Please visit this url to subscribe, unsubscribe and manage your subscription 
 preferences:
 http://lists.runrev.com/mailman/listinfo/use-livecode
 


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode