Last modified: 2011-10-18 18:14:55 UTC
Created attachment 7507 [details] Patch for rescape addition (not tested) Hello, As a filter editor on frwiki, I build a regexp at runtime using the `article_prefixedtext' variable (it could be another variable). It means that I've to escape the variable because it may contain special characters (parenthesis, for example). Unfortunately, it looks like there is no function to do this, so I use several str_replace, which is not convenient nor efficient. I suggest the addition of a new function for regex escaping, using preg_quote. The attached patch is *only* an example of what it might look like: the code has not been tested at all (I've no local install of mediawiki right now). If you think this is a good idea, please let me know, and I'll test myself and submit another patch. Thanks, -- Arkanosis @ frwiki
preg_quote needs two parameters to work properly.
Patch applied in r100135 and r100139. Thanks for submitting it. (In reply to comment #1) > preg_quote needs two parameters to work properly. Not really, rlike already takes care of escaping /s.
Hi Victor, thanks! :-)