Are you using Get or Post? It looks like you're using Get...might I suggest Post.
Therefore you could do it this way: my ($data1,$data2,$data3) = $buffer =~ /value1\=(.*)\&value2\=(.*)\&value3\=(.*)/; then throw $data1, $data2 and $data3 into an array or hash. This way, it won't care if the user enters 45 &'s...b/c the regexp won't even look at them. Regards, Danny -----Original Message----- From: John Stokes [mailto:[EMAIL PROTECTED]] Sent: Monday, December 09, 2002 7:56 PM To: [EMAIL PROTECTED] Subject: Re: Handling & = If I do that, then all of them would be replaced and I'd have the same problem with the - then. How do I distinguish between an & that HTML inserted as a delimiter vs. an & the user entered? (or an =, for that matter) -John On 12/9/02 4:50 PM, "Sven Bentlage" <[EMAIL PROTECTED]> wrote: > Hi John > > why don`t you use a small regex to replace the & ? > Something like : > if ($variable =~ m/&/) {$variable =~ s/&/-/g} > > should replace the ampersand with a "-". (I am not quite sure if you > have to write & or \& ) > > Cheers, > > Sven > > (P.S.: I am definitely sure there are much faster, shorter and better > coded solutions to your problem...so keep your eyes open..) > > On Tuesday, Dec 10, 2002, at 01:31 Europe/Berlin, John Stokes wrote: > >> I have an ongoing problem. >> >> As you know, HTML encodes GET and POST requests using the format: >> "myurl.com?name1=value1&name2=value2&..." >> >> My problem is, I have users constantly using ampersands (&) in text >> fields >> (ex: John & Jane Doe), so my data comes across as: >> "?name1=value1&name2=val&ue2=&name3=value3" etc... >> >> So, when I split this into a hash, the data after a user-entered & is >> effectively lost. My current solution to this is to add a Javascript >> that >> prevents the user from submitting the form if there's an & in the >> likely >> text fields, BUT... >> >> Is there an elegant solution to this? Can Perl process this >> effectively? >> >> Thanks. >> >> -- >> -John Stokes >> Computer Psychiatrist (Director of Information Technology) >> Church Resource Ministries >> [EMAIL PROTECTED] >> >> Three Pillars: Humility, Communication, Balance >> >> >> -- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> -- -John Stokes Computer Psychiatrist (Director of Information Technology) Church Resource Ministries [EMAIL PROTECTED] Three Pillars: Humility, Communication, Balance -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]