This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Replacing & with &

Help for those learning Tcl or writing their own scripts.
Post Reply
t
theice
Voice
Posts: 36
Joined: Thu Mar 13, 2008 4:20 pm

Replacing & with &

Post by theice »

couldn't figure out an easy way after looking around the forums... maybe i'm being a noob...

probably going to use lreplace to do it?

Code: Select all

foreach tr [regexp -all -inline {<tr class="dlc_info_row">.*?</tr>} $data] { 
  regexp {<tr class="dlc_info_row">.*?<td>(.+?)</td>.*?<td>(.+?)</td>.*?<td>(.+?)</td>} $tr - artist title type
 putserv "NOTICE $n :$artist - $title ($type)" 
}
is where it is getting my artist and title

I want it to replace any & in $artist or $title with &
Image
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Code: Select all

putserv "NOTICE $n :[string map {& &} "$artist - $title"] ($type)" 
As more html elements begin to surface, enlarge the string map to encompass them as well.
Also, do not escape the set of double-quotes inside the string map, they are within command/evaluation brackets.
Post Reply