Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Substitute "\\" with "\\\\"

Quote Reply
Substitute "\\" with "\\\\"
Hi,


Last night I modified GT::CGI::unescape.
My try and error experiment with Links SQL...
Anyway,I have added a new substitution line:

$str =~ s/\\/\\\\/g;

after decode line:

$str =~ s/%([0-9a-fA-F]{2})/chr(hex($1))/ge;

Then I could successfully search any character that has "\\" in it.
But worst thing is that newly added Categories and Links (if these characters originally have "\\" code ) are built with extra "\\",messed up character.

How can I limit substitution to only search strings ?

like;

1 Users input search string(s).
2 Check to see if there are any "\\" in search string(s)
3 If there are "\\"s, it is replaced to "\\\\[/url]" ,looking like this;

$search string(s) =~ s/\\/\\\\/g;

4 Then go back to normal search routine.
5 Get searched results

I need to do this anyhow. Any help would be very much appreciated.

Thanks
### Moto ###
Subject Author Views Date
Thread Substitute "\\" with "\\\\" Moto 5375 Oct 18, 2002, 11:09 PM
Thread Re: [Moto] Substitute "\\" with "\\\\"
Paul 5281 Oct 19, 2002, 2:52 AM
Thread Re: [Paul] Substitute "\\" with "\\\\"
Moto 5273 Oct 19, 2002, 3:17 AM
Thread Re: [Moto] Substitute "\\" with "\\\\"
Andy 5266 Oct 19, 2002, 9:50 AM
Thread Re: [Andy] Substitute "\\" with "\\\\"
Paul 5259 Oct 19, 2002, 10:07 AM
Thread Re: [Paul] Substitute "\\" with "\\\\"
Andy 5263 Oct 19, 2002, 10:11 AM
Thread Re: [Andy] Substitute "\\" with "\\\\"
Paul 5263 Oct 19, 2002, 10:25 AM
Thread Re: [Paul] Substitute "\\" with "\\\\"
Andy 5252 Oct 19, 2002, 10:37 AM
Post Re: [Andy] Substitute "\\" with "\\\\"
Moto 5247 Oct 19, 2002, 10:52 AM