[ale] One for the Perl Gurus

Robert L. Harris Robert.L.Harris at rdlg.net
Tue Jan 10 13:18:36 EST 2006



Another of my coworkers suggested:

      if (( $Data =~ /\Q$Target\E/ix ) || ($Topic =~ /\Q$Target\E/ix ))
Which works very well.  $Data and $Target are never eval's or anything.
Just read from irc written to file or the other way around.  I've got
some bounds checking in as well though.

Thus spake fletch at phydeaux.org (fletch at phydeaux.org):

> > I need a good way to sanitize the script other than to do a whole bunch
> > of :
> >
> > $Target =~ s/\./\\./;
> 
> perldoc -f quotemeta
> 
> That'll automatically do the substitution for any regex metacharacters. 
> The problem is that you're basically accepting "code" (in the form of a
> regex) from untrusted users.
> 
> -- 
> Fletch                | "If you find my answers frightening,       __`'/|
> fletch at phydeaux.org|  Vincent, you should cease askin'          \ o.O'
>                       |  scary questions." -- Jules                =(___)=
>                       |                                               U
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale

:wq!
---------------------------------------------------------------------------
Robert L. Harris                     | GPG Key ID: E344DA3B

DISCLAIMER:
      These are MY OPINIONS             "We can't solve problems by using
       ALONE.  I speak for                the same kind of thinking we used
       no-one else.                         when we created them."
                                          - Einstein

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature




More information about the Ale mailing list