Hello How can i do the following : In my Wordpress website, i want to replace something in the post content All instances of : http://play.videolog.tv/videos/xx/xx/yyyyyy.flv Replace with : [videolog]yyyyyy[/videolog] xx can be 2 or 3 digits, but yyyyyy is always 6 numbers. Example : http://play.videolog.tv/videos/93/80/398682.flv to [videolog]398682[/videolog]
You'll need to make a script in PHP or any other language which will parse the content to do the required. This is not possible in MySQL alone.
If you are very sure of the format of existing links that last 6 digit number is the file name you would want in new tag, following example would be helpful. SET @str = 'http://play.videolog.tv/videos/93/80/398682.flv'; SELECT CONCAT('[videolog]', SUBSTRING_INDEX(SUBSTRING_INDEX(@str, '/', -1), '.', 1), '[/videolog]'); Code (markup):
I guess you have some content before and after this string you need replace. I have Query with solution for this, for 50$, I can send you this solution. If you want it send me PM.
@mwasif, Thanks. @duben, Why would you want to offer such costly solution when others are helping in free? Respect community rules and avoid selling services anytime anywhere.
@mastermunj: Because similar solution takes me about 1 hour of work. I didn't see problem to offer complex query for some price. It's similar like offer script. Your solution will work only for setup variable. GreatestSwordsman needs change it in whole database for many records. Usually in WP content there are some random strings before replaced text and some text after. Your solution not count with it. My solution will not drop rest of article, properly replace content and leave the rest unchanged. Just it is not free (I know price for my time).
@mastermunj, BTW, your solution will only work if this url is the only data in the column. If the URL is in between some other text, then it will not be possible to perform the replace operation.
Yes, I am aware about it. I just shared it in case if someone can come up with even better solution using this one.