Search found 789 matches

by Thierry
Thu Nov 07, 2013 9:27 pm
Forum: Talking LiveCode
Topic: Extracting sub strings from a string
Replies: 8
Views: 6626

Re: Extracting sub strings from a string

jacque wrote:Wow. I'll have to look up all that, Thierry. That's amazing.
Probably you should remove the "then" at the end of the line though. ;)
Oups. typo!
I did remove it, thanks.
by Thierry
Thu Nov 07, 2013 8:04 pm
Forum: Talking LiveCode
Topic: Extracting sub strings from a string
Replies: 8
Views: 6626

Re: Extracting sub strings from a string

You could probably do all the replacements with a single line of code by using replaceText. My regex is weak, but it would be something like this: Thierry would know, he breathes regex. . LOL I'm sorry , I fall into a regex pot when I was young :) Ok, here is one quick one not tested: put ExtractTa...
by Thierry
Sun Nov 03, 2013 9:06 am
Forum: Internet
Topic: Find a word in a field and record its location
Replies: 9
Views: 6175

Re: Find a word in a field and record its location

Thanks again Thierry.It works like a charm. I will to be working on a way more complicated html table, and that's been my concern. I didn't know those were called regex(regular-expressions). ARAS Aras, If you plan to go with regex, then I highly recommend you to learn a bit more about it. Here is o...
by Thierry
Sat Nov 02, 2013 10:04 pm
Forum: Internet
Topic: Find a word in a field and record its location
Replies: 9
Views: 6175

Re: Find a word in a field and record its location

on mouseUp answer funwithRegex( "Mark" ) end mouseUp function funwithRegex theName if matchText( field 1, "(?m)<td>" & theName & "</td>\n<td>(\d+)</td>", theValue) then return theValue else return "not found" end if end funwithRegex Thanks Thierry!!! It works when I search Mark. However, when I sea...
by Thierry
Sat Nov 02, 2013 9:00 pm
Forum: Internet
Topic: Find a word in a field and record its location
Replies: 9
Views: 6175

Re: Find a word in a field and record its location

<table border="1"> <tr>... <td>John</td> <td>1.5</td> .... </tr> </table> So the variable will be "1,5" Hi ARAS, Saturday night regex fiever :) So, that's the way I'ld do it: on mouseUp answer funwithRegex( "Mark" ) end mouseUp function funwithRegex theName if matchText( field 1, "(?m)<td>" & theNa...
by Thierry
Sat Nov 02, 2013 8:37 pm
Forum: Internet
Topic: Delete anything between "<" and ">"
Replies: 4
Views: 4525

Re: Delete anything between "<" and ">"

Thank you so much Thierry. It works!!! Could you explain the code below? get replaceText( inputText, "(?m)<[^>]*>", empty) How did it empty words between those symbols? ARAS That's all the magic of regular expression which, in fact, has nothing magic :) Ok, I split the regex: (?m) -> multi-lines be...
by Thierry
Sat Nov 02, 2013 6:40 pm
Forum: Internet
Topic: Delete anything between "<" and ">"
Replies: 4
Views: 4525

Re: Delete anything between "<" and ">"

Hi,

Code: Select all

on mouseUp
   get replaceText( inputText, "(?m)<[^>]*>", empty)
   filter IT without empty
   put IT into outputText
end mouseUp
Regards,

Thierry
by Thierry
Thu Oct 31, 2013 9:20 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Processing & Livecode
Replies: 3
Views: 2423

Re: Processing & Livecode

calmrr3 wrote: I am just wanting to run a processing 'sketch' in a LiveCode app.
Hi,

Have you looked at shell() or launch in LC dictionary?

i.e: launch "/Documents/Projects/test.txt" with myApp

HTH,

Thierry
by Thierry
Mon Oct 28, 2013 9:05 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: Finding a string in a list
Replies: 4
Views: 3124

Re: Finding a string in a list

Hi, If you find that using a regex is not too esoteric, then this small script does what you want and accept empty lines. if matchText( field 1, "(?m)^1155\s+(\d+)", theValue) then return theValue being a bit more verbose: on mouseUp answer funWithArrayLike( 1155 ) end mouseUp function funWithArrayL...
by Thierry
Mon Oct 14, 2013 10:26 am
Forum: Engine Contributors
Topic: ReplaceText: back refs in replacement string
Replies: 8
Views: 7768

Re: ReplaceText: back refs in replacement string

@runrevmark I'm fine with a new function. Just to be sure, I guess that by *This existing code*, you mean old user's code, yes? I have more options for this function in mind.. ( inspired by the Perl substitute s/// ) Is this better to talk about all of them right now or later when I'll be ready to c...
by Thierry
Fri Oct 11, 2013 3:43 am
Forum: Talking LiveCode
Topic: Using Replace with an undefined number in a string
Replies: 7
Views: 4707

Re: Using Replace with an undefined number in a string

jacque wrote:I knew you'd have the answer, Thierry. :-)
A votre service, Madame :)
by Thierry
Fri Oct 11, 2013 2:09 am
Forum: Talking LiveCode
Topic: Using Replace with an undefined number in a string
Replies: 7
Views: 4707

Re: Using Replace with an undefined number in a string

put "hello1234beep some text" into theText replace "hello" & <The Number> & "beep" with "more text" in theText The number could be any integer, and could have any number of digits. You can try this one if your words are fix. NB: I guess there is no space in between words and the number put replaceT...
by Thierry
Thu Oct 10, 2013 5:03 am
Forum: Engine Contributors
Topic: ReplaceText: back refs in replacement string
Replies: 8
Views: 7768

Re: ReplaceText: back refs in replacement string

monte wrote:You're making me want to brush up on my RegEx Thierry
<g>
Please, don't.
I wouldn't like to feel responsible for any brain damage..
by Thierry
Wed Oct 09, 2013 10:49 am
Forum: Engine Contributors
Topic: ReplaceText: back refs in replacement string
Replies: 8
Views: 7768

ReplaceText: back refs in replacement string

Hi, For those liking regex, here is one nice feature missing: put replaceText( "aaa bbb", "(\w+)\s+(\w+)", "\2\1") --> bbb aaa As we can already use back references in our regex (2nd parameter), I think keeping the same syntax is fine : \1, \2, ... Well, guess it's enough for a start :) Any thoughts...
by Thierry
Wed Oct 09, 2013 10:23 am
Forum: Engine Contributors
Topic: Update of RegEx library (libpcre) done
Replies: 10
Views: 9069

Re: Update of RegEx library (libpcre) done

@monte: Great! Worked as you said :)

Next, would like to add some features to replaceText().
new thread coming..

Thierry

Go to advanced search