Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Perl and MySQL - performing a search...

by trs80 (Priest)
on Jan 27, 2003 at 04:04 UTC ( [id://230109]=note: print w/replies, xml ) Need Help??


in reply to Perl and MySQL - performing a search...

There is regular expression support in MySQL that allows for queries like this:
sub detect_profanity { my $str = shift; my $sth = $dbh->prepare (qq{ SELECT * FROM `forbidden_usernames` W +HERE `f_user` REGEXP ? }); $sth->execute($str); my $row = $sth->fetchrow_hashref(); $sth->finish(); return "bad" if $row; }
You can also use several special characters/constructs to limit the matches. See the MySQL docs for more info.

Replies are listed 'Best First'.
Re: Re: Perl and MySQL - performing a search...
by powerhouse (Friar) on Jan 27, 2003 at 05:35 UTC
    EXCELLENT, Thank you, one and all!

    thx,
    Richard

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://230109]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others cooling their heels in the Monastery: (4)
As of 2024-04-18 05:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found