https://bugzilla.wikimedia.org/show_bug.cgi?id=24109

           Summary: New function : regex escaping using preg_quote
           Product: MediaWiki extensions
           Version: any
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: AbuseFilter
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]


Created an attachment (id=7507)
 --> (https://bugzilla.wikimedia.org/attachment.cgi?id=7507)
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

-- 
Configure bugmail: https://bugzilla.wikimedia.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l

Reply via email to