search for regular expression in text and put the results into an array
mikekann at yahoo.com
Thu Nov 5 09:18:31 CST 2009
Here's a script that you might find useful for the XML task.
Put your raw data in fld "a"
Your output will appear in fld "b"
If it is what you need and it isn't perfectly clear how the script works just send me a note and I'll put in some comments.
This is what I have in fld "a" :
When talking about places to eat in Edinburgh Sam mentioned <res>Fishers Bistro</res> but Joe thought that <res>Abstract</res> was the superior eatery. No, Megan replied, <res>Fishers Bistro</res> is where I take all my friends when they visit.
-- put this script in a btn--
-- put your raw text into fld "a"
-- your output appears in fld "b"
put fld "a" into v
put empty into fld "b"
put "<res>" into aTag
put "</res>" into bTag
replace return with "*" in v
replace aTag with return in v
replace bTag with "@" in v
filter v with "*@*"
set the itemDelimiter to "@"
put zero into c
repeat for each line curLine in v
put item 1 of curLine into curTeam
put c + 1 && curTeam & cr after original_order
put c into teams_array[curTeam]
add 1 to c
delete last char of original_order
put cr & "*** original order ***" & cr into h
put h & cr & original_order & cr after fld "b"
put cr & "*** frequency ***" & cr into h
combine teams_array with cr and space
sort teams_array numeric descending by last word of each
put h & cr & teams_array & cr after fld "b"
More information about the use-livecode