Resource icon

Post Content Find / Replace 2.0.1

No permission to download
Relating to the following discussion:

I'm trying to remove these remnant viglinks that still exist long after I've uninstalled the VigLink add on. This post explains why they're still showing up:

In any event, the VigLinks look like this:
Code:
https://redirect.viglink.com/?format=go&jsonp=vglnk_172485894788610&key=b617ddd562e3b6e9c916999f0745de59&libId=m0e0hccj01000b3h000ULqfqvkczaz3jp&loc=https%3A%2F%2Fpontiacforum.com%2Fpontiac%2Fthreads%2F1998-2002-y87-firebird-identification.39586%2F%23post-117590&v=1&opt=true&out=http%3A%2F%2Fi.viglink.com%2F%3Fkey%3D2ecd8bc9fcc7034251aad35a31b16337%26insertId%3Defd9b8a17188ef61%26type%3DM%26exp%3D60%253ACI1C55A%253A1%26libId%3Dk8agt6is01000b3w000MAbwxxrs7l%26loc%3Dhttps%253A%252F%252Fcamaroforums.com%252Fforum%252F93-02-v6-tech-14%252F3800-performance-package-y87-40820%252F%26v%3D1%26iid%3Defd9b8a17188ef61%26opt%3Dtrue%26out%3Dhttp%253A%252F%252Fwww.ebay.com%252Fsch%252FeBay-Motors-%252F6000%252Fi.html%253F_from%253DR40%2526_nkw%253Drear%252Bbrakes%26ref%3Dhttps%253A%252F%252Fwww.google.com%252F%26title%3D3800%2520performance%2520package%2520(y87)%2520-%2520Camaro%2520Forums%2520-%2520Chevy%2520Camaro%2520Enthusiast%2520Forum%26txt%3D%253Cspan%253Erear%2520%253C%252Fspan%253E%253Cspan%253Ebrakes%253C%252Fspan%253E&title=(68)%201998%202002%20Y87%20Firebird%20identification%20%7C%20Pontiac%20Owners%20Group&txt=rear%20brakes

I'm trying to figure this out myself but am not having any luck. What should I be using for the items below?

Quick Find:
Regular Expression:
Replacement String:

Whatever I'm trying gives me the following error:

ErrorException: [E_WARNING] preg_match_all(): Delimiter must not be alphanumeric, backslash, or NUL in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41

XF::handlePhpError()
preg_match_all() in src/addons/XFPR/Admin/Controller/PostReplace.php at line 41
XFPR\Admin\Controller\PostReplace->actionReplace() in src/XF/Mvc/Dispatcher.php at line 352
XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 258
XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2485
XF\App->run() in src/XF.php at line 524
XF::runApp() in admin.php at line 13
You could do it with a query on the dB directly, do you want to null the links at all?
 
I'd like to delete all the links. I guess that's the same as nullifying them...

Maybe something like?

Code:
UPDATE xf_post
SET message = REGEXP_REPLACE(
    message,
    '\\[URL\\]https?:\\/\\/.*?viglink\\.com\\/.*?\\[\\/URL\\]',
    '[URL]replacement[/URL]'
);

But the issue is that the URL's need to be inside the URL code or else , yeah. This may or may not work, worth a try but does require direct DB access. I would try it on a backup db and simulate the results.

Also you'll need to run this query to bypass limitations;

Code:
SET GLOBAL regexp_time_limit=0;
 
Maybe something like?

Code:
UPDATE xf_post
SET message = REGEXP_REPLACE(
    message,
    '\\[URL\\]https?:\\/\\/.*?viglink\\.com\\/.*?\\[\\/URL\\]',
    '[URL]replacement[/URL]'
);

But the issue is that the URL's need to be inside the URL code or else , yeah. This may or may not work, worth a try but does require direct DB access. I would try it on a backup db and simulate the results.

Also you'll need to run this query to bypass limitations;

Code:
SET GLOBAL regexp_time_limit=0;
Thank you, I assume this would work but I'm going to hope and hold out for more input on the find and replace add-on as my preference is to avoid messing around with the database manually...
 
Thank you, I assume this would work but I'm going to hope and hold out for more input on the find and replace add-on as my preference is to avoid messing around with the database manually...
If you use phpmyadmin you can simulate the query on your test dB and it will give you results, if its targetting the correct strings, try it. No harm on a test dB.
 
If you use phpmyadmin you can simulate the query on your test dB and it will give you results, if its targetting the correct strings, try it. No harm on a test dB.
My first issue here is that I've never had the need for a test database until now...
 
How can i replace this

example
/ example /
" example "

The problem here is that we replace " example " <- space before and after
with "example" because the spaces for the replacement are removed.
 
Back
Top Bottom