Opened 12 years ago
Closed 12 years ago
#29119 closed defect (bug) (fixed)
Wrong regex $yt_pattern to manage YouTube videos in wp_video_shortcode
| Reported by: | Fab1en | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | 4.0 |
| Component: | Media | Version: | 3.9.1 |
| Severity: | normal | Keywords: | has-patch |
| Cc: | Focuses: |
Description
wp_video_shortcode uses the following regular expression to find YouTube videos and make them play correctly inside MediaElementJS player :
$yt_pattern = '#^https?://(:?www\.)?(:?youtube\.com/watch|youtu\.be/)#';
I think the :? in front of www and youtube are here to make the parenthesis non capturing. In this case this is incorrect : the right signs to use are ?:. The current formulation (:?) will optionally match a :.
Note that this is not really a bug, because there are no consequences : matches are not used afterward, and : will never appear in a URL at this place. But this is confusing and might cause a bug later.
Attachments (1)
Change History (4)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Correct regex formulation