Whenever you are writing a regex you need to backslash the following / \ . [ ] ? . ^ * and some others (look up regex escaping specail characters)
In PHP you can use other delimiter characters besides / and /, such as # and #. I always use slashes so I can test it in a JavaScript driven regex tester
I've read a lot but did not find a solution for this, although I would expect it as very common.
How do I find and replace such media includes with title or URL, please?
This may occour for YouTube and Vimeo and with mixed character cases:
Code:
[YOUTUBE="This is the title of the video"]on8EBjTftcg[/YOUTUBE]
[YOUTUBE="https://www.youtube.com/watch?v=on8EBjTftcg"]on8EBjTftcg[/YOUTUBE]
[VIMEO="This is the title of the video"]236410761[/VIMEO]
[VIMEO="https://vimeo.com/236410761"]236410761[/VIMEO]
Have you already replaced the closing tags with "[/MEDIA]"?
Don't use those regexes you posted. They will match everything after the opening youtube tag all the way to the end of the post. If you have replaced the closing tags and you can revert it, do so. Those regexes I posted must be able to match the closing tag
I would like to make all Wikipedia hotlinks unformatted text. For example
Turn this: [URL='https://en.wikipedia.org/wiki/Ottoman_Empire']Ottoman Empire[/URL]
Into this: Ottoman Empire
Preferably it would work also for http and for any language like [URL='https://XX.wikipedia.org/wiki/Ottoman_Empire']Ottoman Empire[/URL]
where XX is the language code.