<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi,<div class=""><br class=""></div><div class="">For now, the following regular expression features are supported by content blockers:</div><div class=""><div class=""><ul class=""><li class="">Matching any character with “.”.</li><li class="">Matching ranges with the range syntax [a-b].</li><li class="">Quantifying expressions with “?”, “+” and “*”.</li><li class="">Groups with parenthesis.</li><li class="">Beginning of line (“^”) and end of line (“$”) marker</li></ul></div></div><div class="">However, there doesn’t seem to be a way to find any of the alternatives specified with “|” or find any character not between the brackets "[^]”.</div><div class=""><br class=""></div><div class="">This is an issue when you want to block addresses like <b class=""><a href="http://www" class="">http://www</a>.<a href="http://example.com" class="">example.com</a><font color="#4f7a28" class="">/</font></b>, <b class=""><a href="https://example.com" class="">https://example.com</a><font color="#4f7a28" class="">/</font></b>foobar.jpg, <b class=""><a href="http://example.com" class="">http://example.com</a><font color="#4f7a28" class="">:</font></b>8080 but not <b class=""><a href="http://example.com" class="">http://example.com</a></b><font color="#ff2600" class=""><b class="">.</b></font>hk.</div><div class=""><br class=""></div><div class="">With at least one of those features, you could write something like:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp;&nbsp;{</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"action"</span> : {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"type"</span> : <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"block"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; },</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #d12f1b" class="">"trigger"</span> : {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </span>"url-filter"<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> : </span>"^https?://(www\\.)?example\\.com(/|:|?)+"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div><div class=""><br class=""></div><div class="">or:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(209, 47, 27);" class="">"action"</span>&nbsp;: {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(209, 47, 27);" class="">"type"</span>&nbsp;:&nbsp;<span style="color: rgb(209, 47, 27);" class="">"block"</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;},</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<span style="color: rgb(209, 47, 27);" class="">"trigger"</span>&nbsp;: {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(209, 47, 27);" class=""><span style="color: rgb(0, 0, 0);" class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span>"url-filter"<span style="color: rgb(0, 0, 0);" class="">&nbsp;:&nbsp;</span>"^https?://(www\\.)?example\\.com[^.]"</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;}</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><div class=""><span style="font-size: 12px; font-family: Helvetica;" class="">Please note that in this case, the </span><font face="Menlo" style="font-size: 11px;" class="">if-domain</font>&nbsp;field wouldn’t help for embedded content.</div><div class=""><br class=""></div><div class="">Should I write the same rule many times for the different cases (“/", “:", “?”)? (doesn’t feel like a very elegant solution though). Since they share the same prefix, will these rules be optimized? On the webkit blog, it is written "<i class="">The rules are grouped by the prefix “https?://, and it only counts as one rule with quantifiers.</i>”. Does it mean that it will only count as one rule against the 50,000 rule limit?</div><div style="font-size: 12px; font-family: Helvetica;" class=""><br class=""></div><div style="font-size: 12px; font-family: Helvetica;" class="">Do you see an elegant solution to handle this case? If not, could you please consider adding at least one of those regular expression features for content blockers in Safari?</div><div style="font-size: 12px; font-family: Helvetica;" class=""><br class=""></div><div style="font-size: 12px; font-family: Helvetica;" class="">Thanks.</div><div style="font-size: 12px; font-family: Helvetica;" class=""><br class=""></div><div style="font-size: 12px; font-family: Helvetica;" class=""></div></div></body></html>