Regular expression

paolo mazza mazzapaoloitaly at gmail.com
Wed Mar 10 06:50:33 EST 2010


Thank you Mark
That's perfect!

On Wed, Mar 10, 2010 at 12:42 PM, Mark Schonewille <
m.schonewille at economy-x-talk.com> wrote:

> Hi Paolo,
>
> This works:
>
>     put empty into mySource
>     put empty into myStart
>     put empty into myEnd
>     put matchText("xxxxxx src='HTTPWEB' width='3845' height='334'
> xxxxx","src='([a-zA-Z0-9 ]+)'",mySource)
>     put matchChunk("xxxxxx src='HTTPWEB' width='3845' height='334'
> xxxxx","src='([a-zA-Z0-9 ]+)'",myStart,myEnd)
>     put mySource & cr & myStart & comma & myEnd
>
> Best,
>
> Mark
>
> --
> Best regards,
>
> Mark Schonewille
>
> Economy-x-Talk Consulting and Software Engineering
> Homepage: http://economy-x-talk.com
> Twitter: http://twitter.com/xtalkprogrammer
>
> Economy-x-Talk is always looking for new software development projects.
> Feel free to contact me for a quote.
>
> Op 10 mrt 2010, om 12:30 heeft paolo mazza het volgende geschreven:
>
>
>  To me regular expressions are tricky!
>>
>> I need to extract the string HTTPWEB from the string "xxxxxx src='HTTPWEB'
>> width='3845' height='334' xxxxx"
>>
>> If I use the regular expression (src='.*') and the matchChunk command,
>>
>> I get this string :   "src='HTTPWEB' width='3845' height='334'"    (see
>> the
>> following RevTalk script)
>>
>>
>> Which is the regular expression to get just  the argument of the src
>> variable ( HTTPWEB in this example)?
>>
>> Thanks a lot
>>
>> Paolo Mazza
>>
>> SAMPLE CODE
>>
>> on mouseUp
>>  local TESTO,STRINGA,VAR1,VAR2
>>
>>  put "xxxxxx src='HTTPWEB' width='3845' height='334' xxxxx" into TESTO
>>
>>  put "(src='.*')" into STRINGA
>>
>>  put matchText(TESTO,STRINGA) & return  into message
>>
>>  if matchChunk(TESTO,STRINGA,VAR1,VAR2) then
>>     PUT char VAR1 to  VAR2 of TESTO into message
>>  else
>>     put "not found!" into message
>>  end if
>>
>> end mouseUp
>>
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list