[pmwiki-users] Strange characters, but only in some cases on Markup parse

Christopher Cox chriscox at endlessnow.com
Sat Oct 31 15:59:22 PDT 2026


Consider this cookbook recipe snippet (I'm looking for youtube video links):

Markup('youtu_be_watch','<urllink',
   "/\\b(?>(\\L))(\/\/youtu\.be)\/([^\\s$UrlExcludeChars]+)(\"[0-9]+:[0-9]+\")?/",
   "YoutubeWatchLink");

function YoutubeWatchLink($m) {
   extract($GLOBALS["MarkupToHTML"]); # get $pagename

   $aspectRatio = '';
   error_log('yt site: ' . $m[2]);
   error_log('yt id and parms: ' . $m[3]);

... rest not shown.


If on my page I have:

https://youtu.be/3kx24YtwPKA"4:3"

Looking at my debug log messages I see:

[31-Oct-2026 17:47:33 America/Chicago] yt site: //youtu.be
[31-Oct-2026 17:47:33 America/Chicago] yt id and parms: 3kx24YtwPKA

Which I expect.  This is fine.

But then if I have:

https://youtu.be/euLOyGadyDs&list=PLZOfSznMOwYenRt25XSChMwxxim5bKVOx&index=104

I get (notice the 18B19B at the end):

[31-Oct-2026 17:52:54 America/Chicago] yt site: //youtu.be
[31-Oct-2026 17:52:54 America/Chicago] yt id and parms: 
euLOyGadyDs&list=PLZOfSznMOwYenRt25XSChMwxxim5bKVOx&index=10418B19B

The difference is the m[4] aspect ratio in quotes is missing, But isn't that ok 
here? (zero or one time)  And I'm still not sure what the 18B19B means?

I may just be failing regexp school.



More information about the pmwiki-users mailing list