Help for this page

Select Code to Download


  1. or download this
        "... LIKE '%" . quotemeta($str) . "%' ..."
  2. or download this
        my $pattern= $string_from_user;
        $pattern =~ s#(['%_\[\]])#\\$1#g;
        "... LIKE '%$pattern%' ..."
    
  3. or download this
        LIKE '%\\\\\%%'
  4. or download this
        # Escape "wildcard" characters in user input:
        my $pattern= quotemeta($string_from_user);
        # Escape things processed by 'single quote' parsing:
        $pattern =~ s#([\\'])#\\$1#g;
        "... LIKE '%$pattern%' ..."