<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof"><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(36, 36, 36); background-color: rgb(255, 255, 255);">my
$line = "ACCT/ID Number(s): 1334356";</span><span style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);"><br>
</span><span style="font-family: "Segoe UI", "Segoe UI Web (West European)", "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif; font-size: 14.6667px; color: rgb(36, 36, 36); background-color: rgb(255, 255, 255);">my $d = "ACCT/ID
Number(s):";</span><span style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);"><br>
<br>
</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);">
The parens in $d are metachars, so they don't match actual parens, but are capture markers. You could use "." to match one char </div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);">
my $d = "ACCT/ID Number.s.:";</div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);">
gets</div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">Found ACCT/ID Number(s): in line</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 11pt; color: rgb(0, 0, 0);">
but would also match that sequence with other chars besides parens. You could escape the parens - easier if you then use single quotes, so the escapes won't "go away"</div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">my $d = 'ACCT/ID Number\(s\):';</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);"><br>
</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">gets</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">Found ACCT/ID Number\(s\): in line<br>
<br>
</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">so, the best, as mentioned, is \Q ...\E to escape any metachars between those markers in the match</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">if ($line =~ /\b\Q$d\E(\s|$)/) {<br>
<br>
</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">gets</span></div>
<div class="elementToProof" style="font-family: "Times New Roman", Times, serif; font-size: 14.6667px; color: rgb(0, 0, 0);">
<span style="background-color: rgb(255, 255, 255);">Found ACCT/ID Number(s): in line</span></div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> Chicago-talk <chicago-talk-bounces+andy_bach=wiwb.uscourts.gov@pm.org> on behalf of Richard Reina <richard@rushlogistics.com><br>
<b>Sent:</b> Wednesday, April 3, 2024 12:33 PM<br>
<b>To:</b> chicago-talk@pm.org <chicago-talk@pm.org><br>
<b>Subject:</b> [Chicago-talk] Can anyone help with a regex?</font>
<div> </div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">CAUTION - EXTERNAL:<br>
<br>
<br>
I want to be able to find the sting 'ACCT/ID Number(s):'<br>
<br>
Here's what I've tried so far.<br>
<br>
<br>
my $line = "ACCT/ID Number(s): 1334356";<br>
my $d = "ACCT/ID Number(s):";<br>
<br>
<br>
if ($line =~ /\b$d(\s|$)/) {<br>
<br>
print "Found $d in line\n";<br>
<br>
}<br>
<br>
<br>
_______________________________________________<br>
Chicago-talk mailing list<br>
Chicago-talk@pm.org<br>
<a href="https://mail.pm.org/mailman/listinfo/chicago-talk">https://mail.pm.org/mailman/listinfo/chicago-talk</a><br>
CAUTION - EXTERNAL EMAIL: This email originated outside the Judiciary. Exercise caution when opening attachments or clicking on links.<br>
<br>
</div>
</span></font></div>
</body>
</html>