Don't :) I would use Parse::BBCode instead, with a custom tag definition for video, and a custom text_processor / url_finder callback , see example in Parse-BBCode-0.14/t/14_info.t
$text =~ s{ (?: (^|\s|\>) # $1 ( # $2 (http|https) # $3 ://www.youtube.com/watch\?\.*v= ([a-z0-9-_%]+) # $4 [&\w;=\+\-]* ) ) | (?: \Q[video]\E (^|\s|\>) # $5 ( # $6 (http|https) # $7 ://www.youtube.com/watch\?\.*v= ([a-z0-9-_%]+) # $8 [&\w;=\+\-]* ) \Q[/video]\E ) }{ my $ret = ""; my $https = $3 || $7; my $vid = $4 || $8; $ret .= "<embed>"; $ret .= escapeHTML($vid); $ret .= "</embed>"; $ret; }gmsxie;
In reply to Re: Youtube video parser
by Anonymous Monk
in thread Youtube video parser
by jacksp
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |