[wp-trac] [WordPress Trac] #33924: sanitize_html_class valid characters
WordPress Trac
noreply at wordpress.org
Mon Nov 16 05:02:50 UTC 2015
#33924: sanitize_html_class valid characters
-------------------------------------+-----------------------------
Reporter: m-e-h | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Future Release
Component: Formatting | Version: trunk
Severity: normal | Resolution:
Keywords: has-patch needs-testing | Focuses:
-------------------------------------+-----------------------------
Comment (by dd32):
> {{{'/[\\\\#%&\',-\/:;<=>@`~\^\$\.\!\[\]\|\{\}\(\)\?\*\+"\s]/'}}}
FYI this is over-escaped, it's not causing an issue, but it makes it
harder to read.
This is more readable and should match the same:
{{{'/[\\\\#%&\',:;<=>@`~^$.!|{}()?*+"\s\[\]\/-]/'}}}
Most characters don't need to be escaped within character classes, the
exception being the character class brackets `[]` and the regular
expression delimiter in use `/`, and personally I always put `-` at the
end simply so it can't confuse the PCRE library (`,-\/` is fine, but for
example, `:-;` isn't, unless escaped)
--
Ticket URL: <https://core.trac.wordpress.org/ticket/33924#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list