Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: pages/filters.html

Issue 29767583: Issue 6626 - Document the rewrite filter option (Closed) Base URL: https://hg.adblockplus.org/web.adblockplus.org/
Patch Set: Created May 1, 2018, 7:56 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pages/filter-cheatsheet.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pages/filters.html
===================================================================
--- a/pages/filters.html
+++ b/pages/filters.html
@@ -176,16 +176,19 @@
{{s75 <code><fix>donottrack</fix></code> — for any address matching a blocking rule with
this option and not matching any exception rules with this option a
<a href="http://donottrack.us/">Do-Not-Track header</a> will be sent (requires
Adblock Plus 1.3.5 or higher).}} {{s76 For backwards compatibility it is recommended
to use this option in combination with contradicting type options, this will prevent this
filter from blocking anything in earlier Adblock Plus versions:
<code><fix>*$donottrack,image,~image</fix></code>}}
</li>
+ <li>
+ {{rewriteoption Rewrite the URL with the option <code><fix>rewrite=</fix></code>. You must use a regular expression filter, using <code><fix>$n</fix></code> in the rewrite argument, with n an number between 1 and 100, will insert the n-th parenthesis submatch of the filter. Anything not explicitely matched by the regular expression will be added in the rewritten string. For example <code><fix>/(server.com\/assets\/file.php)\?.*$/$rewrite=$1</fix></code> will rewrite the URL by removing everything that comes after ".php". If there is no query parameter (i.e. no '?'), this filter won't match. The rewrite parameter us the same syntax as JavaScript <code><fix>String.prototype.replace()</fix></code> when using a regular expression instead of a substring.}}
Sebastian Noack 2018/05/05 14:48:37 I rather review larger texts with Google Docs: htt
Sebastian Noack 2018/05/08 06:32:23 The edited version in the Google Doc looks good to
hub 2018/05/08 13:36:11 Done.
+ </li>
</ul>
<h4 id="regexps">{{s77 Using regular expressions}}</h4>
<p>{{s79 If you want even more control about what your filters match and what they don't match, you can use regular expressions. For example the filter <code><fix>/banner\d+/</fix></code> will match <code><fix>banner123</fix></code> and <code><fix>banner321</fix></code> but not <code><fix>banners</fix></code>. You can check out <a href="{{s79-link https://developer.mozilla.org/en/Core_JavaScript_1.5_Guide/Regular_Expressions#Writing_a_Regular_Expression_Pattern}}">documentation on regular expressions</a> to learn how to write them.}}</p>
<p>{{s80 <em>Note</em>: For performance reasons it is recommended not to use regular expressions if they can be avoided.}}</p>
« no previous file with comments | « pages/filter-cheatsheet.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld