[Chicago-talk] Can anyone help with a regex?

Shlomi Fish shlomif at shlomifish.org
Wed Apr 3 10:52:11 PDT 2024


Hi Richard,

On Wed, 03 Apr 2024 13:33:04 -0400
"Richard Reina" <richard at rushlogistics.com> wrote:

> I want to be able to find the sting 'ACCT/ID Number(s):' 
> 
> Here's what I've tried so far.
> 
> 
> my $line = "ACCT/ID Number(s): 1334356";
> my $d = "ACCT/ID Number(s):";
> 
> 
> if ($line =~ /\b$d(\s|$)/) {
> 
>     print "Found $d in line\n";
> 
> }
> 

Please see
https://perl-begin.org/FAQs/freenode-perl/#How_can_I_match_a_string_variable_inside_a_regex.3F
and https://perl-begin.org/topics/security/code-markup-injection/ and quotemeta
and \Q … \E .

>  
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at pm.org
> https://mail.pm.org/mailman/listinfo/chicago-talk



-- 

Shlomi Fish       https://www.shlomifish.org/
https://www.shlomifish.org/humour/Summerschool-at-the-NSA/

You have a Mac server? Next you'll tell me that you have an HP-UX desktop.
    - ##programming

Please reply to list if it's a mailing list post - https://shlom.in/reply .


More information about the Chicago-talk mailing list