<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">
<div class="">version 3.26.1</div>
<div class=""><br class="">
</div>
I am attempting to use rewrite to copy part of one macro into a new one:
<div class=""><br class="">
</div>
<div class=""><font face="Menlo" class="">rewrite r_user1 { set( "${user}", value("user_name"));};<br class="">
rewrite r_user2 { subst( "^.+\((.+)\)", "${1}", value("user_name")) ;};<br class="">
</font><br class="">
</div>
<div class="">The first simply copies <font face="Menlo" class="">user</font> into
<font face="Menlo" class="">user_name.</font></div>
<div class="">The second is intended to extract anything in parentheses and throw away the rest.</div>
<div class=""><br class="">
</div>
<div class="">here is a cleaned up dump of json output including the macros from the regexp:</div>
<div class=""><br class="">
</div>
<div class="">
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">{"user_name":")","user”:”yyyyn@gmail</span><span style="font-variant-ligatures: no-common-ligatures" class="">.com(xxx549)"</span><span style="font-variant-ligatures: no-common-ligatures" class="">,"2":")","1":")","0”:”yyyy@<span style="caret-color: rgb(255, 255, 255);" class="">gmail</span></span><span style="font-variant-ligatures: no-common-ligatures" class="">.com(xxx549)”}</span></div>
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal;" class="">
I believe ‘1’ should contain ‘xxx549’ not ‘)’.</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal;" class="">
I have tested the regexpn in ruby’s irb and it works fine there.</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal;" class="">
here is another example this one where the regexp should not have matched at all:</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal;" class="">
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class="">{"user_name":"9","user":"ping999","2":"9","1":"9","0":"ping999”}</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal; font-family: Menlo;" class="">
<span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class="">macros 1 and 2 always seem to contain the last character of the original string.</span></div>
<div style="margin: 0px; font-stretch: normal; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures;" class=""><br class="">
</span></div>
<div class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class="">
</span></div>
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<br class="">
</div>
<div style="margin: 0px; font-stretch: normal; font-size: 11px; line-height: normal; font-family: Menlo;" class="">
<br class="">
</div>
</body>
</html>