Quantcast
Channel: phpBB.com
Viewing all articles
Browse latest Browse all 2735

phpBB Custom Coding • Re: Modifying quotes in MySQL and "re-submitting" the posts

$
0
0
you need to use a regex
That should be:

Code:

UPDATE phpbb_posts    SET post_text= REGEXP_REPLACE       ( post_text       , '\\[quote="([^"]+)" [^\\]]+\\]'  -- capturing the username, match all quotes that have more than only a username       , '[quote="\\1"]'                  -- substitute previously captured username, dump the rest       );
(Double backslash because one would escape the string literal, but we want to go beyond the string literal right to the regex.) Try this first on a selected post which contains such a quotation and where you can imagine how it should look like afterwards:

Code:

SELECT REGEXP_REPLACE       ( post_text       , '\\[quote="([^"]+)" [^\\]]+\\]'       , '[quote="\\1"]'       ) AS new  FROM phpbb_posts WHERE post_id= ?;
However, keep in mind that quotes are not limited to posts - they can also occur in PMs, signatures, polls, forum descriptions, and data from extensions.

Statistics: Posted by AmigoJack — Thu Jan 04, 2024 2:13 am



Viewing all articles
Browse latest Browse all 2735

Trending Articles