Regex in scrip won't match multi-line strings
Peter Nikolaidis <[email protected]> Mon, 27 Feb 2017 10:48:18 -0500
| Newsgroups | gmane.comp.bug-tracking.request-tracker.user |
|---|---|
| Message-ID | <CACiQX-ozMieLRCKD16Uh=ZBmRz8KO80_fZ2aWbsG931Zq=_R8A@mail.gmail.com> |
--001a11449c8c84c0dd054985047c Content-Type: text/plain; charset=UTF-8 Hi all, I'm trying to automatically resolve tickets that don't require any action. In this example, I receive a backup notification. I know it's a backup script result email based on the subject, and I know the backup was successful (and therefore I can auto-resolve the ticket) if another regex matches the body. When I match against the subject line alone, it works. However, when I try to match against the mutli-line body, it never matches (even though when I run the regex against the string in a test, it matches as expected). Are multi-line matches not an option, or do I need to test in another way? This is an extract of the test I am running: (($self->TicketObj->Subject =~ /Cron \<root\@blah\> \/usr\/bin\/s3cmd sync \/var\/spool\/blah\/ s3\:\/\/somes3buckethere\//) && ($self->TicketObj->Body =~ /Done\. Uploaded \d* bytes in \d\.\d seconds/)) Thank you, Peter -- Peter Nikolaidis CISSP <https://webportal.isc2.org/custom/CertificationVerificationResults.aspx?FN=Peter&LN=Nikolaidis&CN=453003> , GCFE <https://www.giac.org/certified-professional/peter-nikolaidis/118082> , GCIH <https://www.giac.org/certified-professional/peter-nikolaidis/118082> , GPPA <http://www.giac.org/certified-professional/peter-nikolaidis/118082> , GSNA <http://www.giac.org/certified-professional/peter-nikolaidis/118082> Paradigm Consulting Co. MA:617.517.2940 <(617)%20517-2940> * NH:603.676.7119 <(603)%20676-7119> * VT:802.234.6368 <(802)%20234-6368> http://pa.radigm.com --001a11449c8c84c0dd054985047c Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div>Hi all,</div><div><br></div><div>I'm trying to au= tomatically resolve tickets that don't require any action. In this exam= ple, I receive a backup notification. I know it's a backup script resul= t email based on the subject, and I know the backup was successful (and the= refore I can auto-resolve the ticket) if another regex matches the body. Wh= en I match against the subject line alone, it works. However, when I try to= match against the mutli-line body, it never matches (even though when I ru= n the regex against the string in a test, it matches as expected).</div><di= v><br></div><div>Are multi-line matches not an option, or do I need to test= in another way? This is an extract of the test I am running:</div><div><br= ></div><div><div>(($self->TicketObj->Subject =3D~ /Cron \<root\@bl= ah\> \/usr\/bin\/s3cmd sync \/var\/spool\/blah\/ s3\:\/\/somes3buckether= e\//) &&=C2=A0</div><div><span class=3D"m_-5002710415745388931gmail= -Apple-tab-span" style=3D"white-space:pre-wrap"> </span> ($self->TicketO= bj->Body =3D~ /Done\. Uploaded \d* bytes in \d\.\d seconds/))</div></div= ><div><br></div><div><div>Thank you,</div><div><br></div><div>Peter</div>--= <br><div class=3D"m_-5002710415745388931gmail_signature"><div dir=3D"ltr">= <div><div dir=3D"ltr"><div><div dir=3D"ltr"><div><div dir=3D"ltr"><div dir= =3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr"><div dir=3D"ltr" style=3D"font-s= ize:12.8px">Peter Nikolaidis<br><a href=3D"https://webportal.isc2.org/custo= m/CertificationVerificationResults.aspx?FN=3DPeter&LN=3DNikolaidis&= CN=3D453003" target=3D"_blank">CISSP</a>,=C2=A0<a href=3D"https://www.giac.= org/certified-professional/peter-nikolaidis/118082" target=3D"_blank">GCFE<= /a>,=C2=A0<a href=3D"https://www.giac.org/certified-professional/peter-niko= laidis/118082" style=3D"font-size:12.8px" target=3D"_blank">GCIH</a><span s= tyle=3D"font-size:12.8px">,=C2=A0</span><a href=3D"http://www.giac.org/cert= ified-professional/peter-nikolaidis/118082" style=3D"font-size:12.8px" targ= et=3D"_blank">GPPA</a><span style=3D"font-size:12.8px">,=C2=A0</span><a hre= f=3D"http://www.giac.org/certified-professional/peter-nikolaidis/118082" st= yle=3D"font-size:12.8px" target=3D"_blank">GSNA</a></div><div dir=3D"ltr" s= tyle=3D"font-size:12.8px">Paradigm Consulting Co.<br>MA:<a href=3D"tel:(617= )%20517-2940" value=3D"+16175172940" target=3D"_blank">617.517.2940</a> * N= H:<a href=3D"tel:(603)%20676-7119" value=3D"+16036767119" target=3D"_blank"= >603.676.7119</a> *=C2=A0VT:<a href=3D"tel:(802)%20234-6368" value=3D"+1802= 2346368" target=3D"_blank">802.234.6368</a>=C2=A0<br><a href=3D"http://pa.r= adigm.com/" target=3D"_blank">http://pa.radigm.com</a></div></div></div></d= iv></div></div></div></div></div></div></div></div> </div></div> --001a11449c8c84c0dd054985047c--