[ic] swish search - quotes

Peter peter at pajamian.dhs.org
Wed Feb 7 19:26:08 EST 2007


On 02/07/2007 01:06 PM, Dan Bergan wrote:
> However it looks like I will have to do some hacking in Swish.pm it
> looks like quotes are always removed as "unsafe charachers":
> $spec =~ s/[^-\w()"\s\*]+//g
>     and $CGI::values{debug}
>     and ::logError("Removed unsafe characters from search string");
> 
> (My regex skills may be a bit rusty, so please correct me if I'm reading
> either of these wrong!)
> 
> Does this seem like a reasonable thing for me to do in Swish.pm:
> #removed quote char (") from regex
> $spec =~ s/[^-\w()\s\*]+//g
>     and $CGI::values{debug}
>     and ::logError("Removed unsafe characters from search string");

You got it backwards, the ^ negates the character set, so it's removing
characters that *don't* match anything in the set.  " is explicitly allowed.

Peter



More information about the interchange-users mailing list