RMcGirr83 wrote: Fri Sep 08, 2017 12:35 pm
Maybe I don't understand but what populates this?
It's using regex.
Code: Select all
'http://example.com/about([0-9]{1,5}).html'
That gets me the topic ID and it's held in the placholder \\1
If I just wanted to do this it will work fine.
Code: Select all
UPDATE phpbb_posts SET post_text = REGEXP_REPLACE
(
post_text,
'http://example.com/about([0-9]{1,5}).html',
'https://example.com/forum/viewtopic.php?t=\\1')
)
I have been using this right in phpMyadmin for many one off queries for a pattern match. This for example will get the correct forum ID for the topic 12345 from the topics table assuming there is topic ID in the topics table 12345
Code: Select all
UPDATE phpbb_posts SET post_text = REGEXP_REPLACE
(
post_text,
'http://example.com/about([0-9]{1,5}).html',
CONCAT('https://example.com/forum/viewtopic.php?f=' , (SELECT `forum_id` FROM phpbb_topics WHERE `topic_id` = 12345) , '&t=\\1')
)
The issue is getting topic ID held in placeholder into the select statement.
“Results! Why, man, I have gotten a lot of results! I have found several thousand things that won’t work.”
Attributed - Thomas Edison