Make WordPress Core

Opened 11 years ago

Last modified 4 years ago

#22330 new enhancement

Optimize regexes to remove protocol from URL

Reported by: geertdd's profile GeertDD Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.2
Component: Formatting Keywords: has-patch needs-unit-tests needs-testing needs-refresh
Focuses: Cc:


Regexes used to chop off the protocol of a URL should be anchored to the start of the string.

  1. The regex fails faster and thus avoid useless work. No need to look further down the URL for strings like "http://".
  2. The regex should not alter any URLs that might be contained in the query string.

Attachments (2)

22330.diff (4.3 KB) - added by GeertDD 11 years ago.
22330.2.diff (3.1 KB) - added by nacin 9 years ago.

Download all attachments as: .zip

Change History (5)

11 years ago

#1 @nacin
9 years ago

  • Component changed from General to Formatting
  • Keywords needs-unit-tests needs-refresh added
  • Milestone changed from Awaiting Review to Future Release

9 years ago

#2 @nacin
9 years ago

  • Keywords needs-testing added; needs-refresh removed

I think 22330.2.diff is a full refresh of the remaining instances here. We do need to make sure that these don't break anything, though. (They look good at a glance.) In some cases these are unit-testable, as well.

#3 @chriscct7
8 years ago

  • Keywords needs-refresh added
  • Severity changed from minor to normal
Note: See TracTickets for help on using tickets.