[wp-trac] [WordPress Trac] #32878: More readable regular expressions for Press This URL's

WordPress Trac noreply at wordpress.org
Fri Jul 3 12:22:48 UTC 2015


#32878: More readable regular expressions for Press This URL's
--------------------------+-----------------------------
 Reporter:  dd32          |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Press This    |    Version:
 Severity:  normal        |   Keywords:  has-patch
  Focuses:                |
--------------------------+-----------------------------
 The regular expressions in Press This are hard to read.
 The attached patch does (probably among other things)
 - Switches to using `!` instead of `/` as the delimiter, so that `/`
 doesn't need escaping inline
 - Removes the escaping of `?` and `.` within character maps `[.?]` as they
 don't need escaping there
 - Adds case-insensitive matching to most expressions, aside from `/wp-
 includes/`
 - Removes the usage of `{1}` as a single-character match is implied
 - Not certain what `preg_match( '/\/ad[sx]{1}?\//', $src )` was supposed
 to match (`/ad/`, `/ads/`, and `/adx/`? If so, it's not currently matching
 `/ad/`, which this patch changes)

 The patch is untested so far, needs to be reviewed to check I didn't miss
 anything.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32878>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list