Re: safe regex in variable

2004-06-14 Thread Randy W. Sims
Jeff 'japhy' Pinyan wrote: On Jun 11, JupiterHost.Net said: Randy W. Sims wrote: A better solution would be to allow only a subset of metacharacters, escaping everything else. This would requre much more effort, but would be safer. Perhaps there is a module that does something like this? If not,

Re: safe regex in variable

2004-06-13 Thread Jeff 'japhy' Pinyan
On Jun 11, JupiterHost.Net said: >Randy W. Sims wrote: > >> A better solution would be to allow only a subset of metacharacters, >> escaping everything else. This would requre much more effort, but would >> be safer. Perhaps there is a module that does something like this? If >> not, there should

Re: safe regex in variable

2004-06-12 Thread Randy W. Sims
On 6/11/2004 11:49 PM, Jupiterhost.Net wrote: Randy W. Sims wrote: JupiterHost.Net wrote: Do what I'd like to be able to do is: my ($find,$replacewith,$case) = $dbh->selectrow_array($query); $string =~ s/$find/$replace/gi if $case; $string =~ s/$find/$replace/g if !$case; Since a user could put wh

Re: safe regex in variable

2004-06-11 Thread JupiterHost.Net
Randy W. Sims wrote: JupiterHost.Net wrote: Do what I'd like to be able to do is: my ($find,$replacewith,$case) = $dbh->selectrow_array($query); $string =~ s/$find/$replace/gi if $case; $string =~ s/$find/$replace/g if !$case; Since a user could put whatever they want in the database what should

Re: safe regex in variable

2004-06-11 Thread Randy W. Sims
JupiterHost.Net wrote: Do what I'd like to be able to do is: my ($find,$replacewith,$case) = $dbh->selectrow_array($query); $string =~ s/$find/$replace/gi if $case; $string =~ s/$find/$replace/g if !$case; Since a user could put whatever they want in the database what should I do to make that work

Re: safe regex in variable

2004-06-11 Thread JupiterHost.Net
Do what I'd like to be able to do is: my ($find,$replacewith,$case) = $dbh->selectrow_array($query); $string =~ s/$find/$replace/gi if $case; $string =~ s/$find/$replace/g if !$case; Since a user could put whatever they want in the database what should I do to make that work so its safe? If there

Re: safe regex in variable

2004-06-10 Thread Randy W. Sims
On 6/10/2004 11:35 PM, JupiterHost.Net wrote: Hello group! I'm wanting to have a safe way to use variables in regexp. I've heard its very dangerous to just run it because people could have evil stuff in the variable to do bad bad things... so $foo =~ m/$evilregexhere/; could be bad unless $evilre

safe regex in variable

2004-06-10 Thread JupiterHost.Net
Hello group! I'm wanting to have a safe way to use variables in regexp. I've heard its very dangerous to just run it because people could have evil stuff in the variable to do bad bad things... so $foo =~ m/$evilregexhere/; could be bad unless $evilregex was untainted (no relation to -T ;p) I'v