Answer the question
In order to leave comments, you need to log in
How to correctly replace a link with a query in mysql?
Please tell me how to make a request. You need to remove the link from the title.
UPDATE `content` SET `title` = REPLACE( `title`, '<a href="telnet://*">', '' ) ;
Answer the question
In order to leave comments, you need to log in
UPDATE `content`
SET
`title` = REPLACE(`title`, CONCAT('<a href="">', `field`, '</a>'), '' );
Perhaps I didn't phrase it correctly. In the title field inside the text there are links of the form <a href="telnet://192.168.1.1">
(ip different) you need to remove them completely without deleting other text. I'll remove the closing </a>
one with another request.
Not the best option.
SELECT CONCAT(SUBSTRING_INDEX(withLink,'<', 1), REPLACE(SUBSTRING_INDEX(withLink,'>', -2),'</a>','')) as withoutLink FROM ...
-- for testing
SELECT 'something <a href="telnet://192.168.1.1">some text</a> dasdsdgdfg' as withLink, (SELECT CONCAT(SUBSTRING_INDEX(withLink,'<', 1), REPLACE(SUBSTRING_INDEX(withLink,'>', -2),'</a>',''))) as withoutLink
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question