On Nov 13, 4:56 pm, [EMAIL PROTECTED] (Deviloper) wrote: > I have a SQL-Statement with a Regular Expression and I want to use a scalar > in that expression: (Looking for something like "$tool =~ m/\Q$x\E/" ) > > #Find tools with xxxxxx in the name: > $dbh->prepare ("SELECT name FROM toolbox WHERE name REGEX '$x'"); > #or > $dbh->prepare ("SELECT name FROM toolbox WHERE name RLIKE '$x'"); > $sth->execute(); > my ($name_of_tool) = $sth->fetchrow_array; > $sth->finish(); > > (Don´t need to mention that this don´t work as expected, but I don´t know how > to escape it the right way. ^^) > > Thanks, > Bastian
Why dont you just use LIKE '%$x%' in your double quoted sql query if its just a string you want to search within a string? Remember to untaint $x if it's untrusted. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/