Using INSTR and SUBSTR you can exclude Url and Title. For instance, create test data:
CREATE TABLE TableName (url varchar(255));
INSERT INTO TableName VALUES
('<!-- m --><a class="postlink" href="link">A</a><!-- m -->');
Query link between 'href="'
and '">'
:
select
substr(url, instr(url, 'href="')+6, instr(url, '">')-instr(url, 'href="')-6) link
from TableName;
+------+
| link |
+------+
| link |
+------+
Query title between '">'
and '</a>'
:
select
substr(url, instr(url, '">')+2, instr(url, '</a>')-instr(url, '">')-2) title
from TableName;
+-------+
| title |
+-------+
| A |
+-------+
Update all required rows:
UPDATE TableName
SET url = concat('[url=', substr(...), ']', substr(...), '[/url]' )
WHERE url like '%<a href=%';