Re: Converting with Regular Expressions

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu