Beefy Boxes and Bandwidth Generously Provided by pair Networks DiBona
go ahead... be a heretic
 
PerlMonks  

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

by trs80 (Priest)
on Jan 27, 2003 at 04:04 UTC ( #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.


Comment on Re: Perl and MySQL - performing a search...
Download Code
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
Node Status?
node history
Node Type: note [id://230109]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (9)
As of 2014-04-20 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (488 votes), past polls