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.

regsub ..

Old posts that have not been replied to for several years.
Locked
l
loze

Post by loze »

I need to remove "Soundic-radio dj: " from $line.. but its aint work with a space on the end.. how do i do to remove it.

regsub -all "Soundic-radio dj: " $line "" line

do not work..

regsub -all "Soundic-radio dj:" $line "" line

works but then the space still there.
l
loze

Post by loze »

oops, sorry it works after a restart :wink:
l
loze

Post by loze »

but i have an other problem.
why doesnt & replace with & in this regsub??

regsub -all "&" $line "&" line
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

because of the way it handles & in regexp matching

regsub -all "&" $line "\&" line

is what you need
l
loze

Post by loze »

why just three signs ??
P
Petersen
Owner
Posts: 685
Joined: Thu Sep 27, 2001 8:00 pm
Location: Blackpool, UK

Post by Petersen »

because the expression is expanded twice when evaluated, thus you've gotta escape the thats escaping the &, and thus escape the thats escaping the , so you end up with 3
l
loze

Post by loze »

ok, thanks for helping.
Locked