Re: Converting with Regular Expressions
- Posted by _tom (admin) Jan 21, 2011
- 1976 views
You may avoid a regex if this works for you:
include std/sequence.e sequence in = """<a href="http://www.mydomain.com/index.esp?var1=1&var2=2">A LINK</a>""" sequence want = """[[http://www.mydomain.com/index.esp?var1=1&var2=2 -> A LINK]]""" sequence out = transmute( in, { {}, `<a href="http:` , `">A LINK</a>` } , { {}, `[[http:` , ` -> A LINK]]` } ) puts(1, want) puts(1, "\n" ) puts(1, out ) puts(1, "\ndone" )
tom

