Selecting text using REGEX
Alex Rice
alex at mindlube.com
Sun Sep 28 09:14:00 EDT 2003
On Friday, September 26, 2003, at 10:16 PM, Bojsza wrote:
> I have a large file that I have loaded into a field "incoming". I wish
> to parse particular text pieces out into another field "outgoing".
>
> The text is always between "value=question?>" and ends with "<" #the
> quotes are not part of the text
>
> example
>
> value=question?> TEXT I WISH TO PARSE OUT<
>
> Any suggestions would be helpful (I have several hundred lines to
> search through).
I good job for regular expressions. Using regex the solution might vary
depending if each a match is allowed to span more than one line or not.
One solution could be:
local tResult
repeat for each line tLine in fld "incoming"
if matchText(tLine, "value=question\?>(.+)<", tMatch) then
put tMatch & linefeed after tResult
end if
end repeat
put tResult into fld "outgoing"
Alex Rice <alex at mindlube.com> | Mindlube Software | http://mindlube.com
what a waste of thumbs that are opposable
to make machines that are disposable -Ani DiFranco
More information about the use-livecode
mailing list