Problem with find_replace
- Posted by drifter Oct 29, 2014
- 1041 views
Hi all,
I remember stumbling upon Euphoria almost 10 years ago while in college. Just stumbled upon it again trying to find a language to port a Perl prototype to.
I'm having a hard time with find_replace(). I am trying to cycle through a sequence which contains the substrings I want to replace, and use them as regular expressions. But the following code fails on
r = re:new(inlineCommands[i])
and not sure what it is I'm doing wrong.
regex re_inlineCommands = re:new("<.*?<") regex r sequence currentline = "here is some <bold<text> and some <italic<text> and <cmd 1, cm2, cmd3<multiple> and <bold<text>.\n" sequence inlineCommands = re:all_matches(re_inlineCommands, currentline) for i = 1 to length(inlineCommands) do r = re:new(inlineCommands[i]) currentline = find_replace(r, currentline, "<b>") end for puts(1, currentline)
Any pointers from experienced Euphorians would be greatly appreciated.
regards,
yves