Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
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.

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
Node Status?
node history
Node Type: note [id://230109]
help
Chatterbox?
[Cosmic37]: greetings earthlings please can someone improve my pathetic perl knowledge
[Cosmic37]: I have 2 files each with datetime and other data in unknown order and I want to find rows from both files matching by datetime and output them combined/ concatenated
[Corion]: Sure
[Corion]: Do you have any specific interests or general Perl knowledge?
[Cosmic37]: should I slurp? should I grep? Noble Lords I wish you good karma and beg your advice
[Corion]: Cosmic37: Ah, see perlfaq4, about How do I compute the intersection of two arrays
[Cosmic37]: I am out of practice; I use Perl for scientific programming for number crunching

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (11)
As of 2017-06-29 16:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (672 votes). Check out past polls.