If the youtube/google url is wrapped in tags, as is the case with a href the regex should probably not run, so I added this as a bug, but it could be a feature request:

By making the regex dependent on a space \s before the url this should just leave it as a plain href link, without swapping in the embed/object code.

Ex. with \s added to the beginning of the search pattern:

preg_replace_callback('!\s(((http://)?)|(^./))(((www.)?)|(^./))youtube\.com/watch[?]v=([^\[\]()<.,\s\n\t\r]+)!i', 'googtube_youtube', $text);

Note. This should work as long as there is not a sloppy href with a space in it, like " http://", in which case my knowledge of regex's is limited, so I don't know what to suggest.

Comments

alexiscott’s picture

Title: Leave as link when url enclosed in tags » Leave as link when url enclosed in quotes

Sorry, typo in the description, typed tags but meant quotes.

alexandreracine’s picture

Category: bug » feature
Status: Active » Postponed (maintainer needs more info)

Could you create a patch and test it? If it works, I would test it too and commit. Thanks.

alexandreracine’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Reopen if someone has a patch.

Dmoz’s picture

Sounds good to me. Typically you would leave the url alone in this case.

For Medical Equipment or Medical Supplies, visit QuickMedical.

edwardpan1’s picture

create a patch and test it