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
SELECT CONCAT(SUBSTRING_INDEX(SUBSTRING_INDEX('/a/b/c/110/h4eheh.jpg','/',-2),'/',1),'_somestring.',SUBSTRING_INDEX('/a/b/c/110/h4eheh.jpg','.',-1)) as image
SET @q = '/a/b/c/110/h4eheh.jpg';
SET @a1 = SUBSTRING_INDEX(SUBSTRING_INDEX(@q,'/',-2),'/',1);
SET @a2 = SUBSTRING_INDEX(@q,'.',-1);
SELECT @q, CONCAT(@a1,'_somestring.',@a2),@a2