[WEB4LIB] WEB4LIB digest 2529

Kenneth Irwin kirwin at wittenberg.edu
Thu Feb 14 10:23:43 EST 2002


>
> It breaks down at the "&" between the input values. What I need there is a
> "+" so the URL reads: 
> http://cals.evergreen.edu/search~s2/d?SEARCH=Milton+%28WASH%29+--+Newspapers=
> That URL works perfectly fine.
> Any simple way to achieve this?


my preferred way of doing this sort of thing is to replace all strings of 1 or
more non-word characters with a +

in perl: 
$search = s/[^0-9a-zA-Z]+/\+/g;
in PHP
$search = preg_replace("/[^0-9a-zA-Z]+/","+",$search);
=> 
$url = "http://cals.evergreen.edu/search~s2/d?SEARCH=$search";

I hope this helps,
Ken
Ken Irwin                                               kirwin at wittenberg.edu
Reference/Electronic Resources Librarian        (937) 327-7594
Thomas Library, Wittenberg University 


*********************************************************************
Due to deletion of content types excluded from this list by policy,
this multipart message was reduced to a single part, and from there
to a plain text message.
*********************************************************************



More information about the Web4lib mailing list