Resource icon

Post Content Find / Replace 1.0.0

No permission to download
@Burp Actually, they are irregular because some URL's was fetched the title of page but we don't need to change title. Title same already. But BBCode changing already

So i think we need to replace two structure.

First (with Title)
Code:
[URL='http://www.domain.com/cep-telefonlari-genel/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor-670541.html']Avea, 41 MP kameralı Nokia 808 PureView’ı satışa sunuyor[/URL]

Second (without title)
Code:
[url]http://www.domain.com/cep-telefonlari-genel/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor-670541.html[/url]

So mutual point looking just URL ( we dont need include the or other parts i think)
We need regex like beginning with ht tp://www.domain.com and ending with .html . That is old URL structure.
 
Oke, I'll give it a try to find out what you really want :)

So:
Code:
[URL='http://www.domain.com/cep-telefonlari-genel/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor-670541.html']Avea, 41 MP kameralı Nokia 808 PureView’ı satışa sunuyor[/URL]

Has to be changed in:
Code:
[URL=http://www.domain.com/threads/670541]Avea, 41 MP kameralı Nokia 808 PureView’ı satışa sunuyor[/URL]

Change the domain.com part to see if this is the link you are searching for.
 
I've changed the links without title to links with title on our forum. It's not to hard but titles are then like "avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor"
 
If we change the URL to http://www.domain.com/threads/670541 then xenforo will go 301 redirect to main thread url again. That is unneeded. So, we must replace the URL to final URL i think.

We have 2 different URL structure as i told before. Firstly, with thread titles another without title.

Code:
[URL='http://www.domain.com/cep-telefonlari-genel/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor-670541.html']Avea, 41 MP kameralı Nokia 808 PureView’ı satışa sunuyor[/URL]
Must replace to =>
Code:
[URL='http://www.domain.com/forum/konu/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor.670541/']Avea, 41 MP kameralı Nokia 808 PureView’ı satışa sunuyor[/URL]

-----

Code:
[url]http://www.domain.com/cep-telefonlari-genel/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor-670541.html[/url]
Must replace to =>
Code:
[url]http://www.domain.com/forum/konu/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor.670541/[/url]

Btw, "forum" directory is constant, we moved the xenforo to forum directory. "konu" directory is routed text of standart "threads" text.

Thanks for your help. @Burp
 
Code:
[url]http://www.domain.com/cep-telefonlari-genel/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor-670541.html[/url]
Must replace to =>
Code:
[url]http://www.domain.com/forum/konu/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor.670541/[/url]
Btw, "forum" directory is constant, we moved the xenforo to forum directory. "konu" directory is routed text of standart "threads" text.

Thanks for your help. @Burp

Quick find:
Code:
[url]

Regex:
Code:
#\[url]http://www\.domain\.com/([^./]+)/(.*[^0-9])([0-9][0-9]*).html\[/url]#siu

Replace:
Code:
[url]http://www.domain.com/forum/konu/\2.\3[/url]

Please test first! and also do some manual replaces to see if the replacement string does work correctly.

Please let me know.
 
Last edited:
Code:
[URL='http://www.domain.com/cep-telefonlari-genel/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor-670541.html']Avea, 41 MP kameralı Nokia 808 PureView’ı satışa sunuyor[/URL]
Must replace to =>
Code:
[URL='http://www.domain.com/forum/konu/avea-41-mp-kamerali-nokia-808-pureviewai-satisa-sunuyor.670541/']Avea, 41 MP kameralı Nokia 808 PureView’ı satışa sunuyor[/URL]

Btw, "forum" directory is constant, we moved the xenforo to forum directory. "konu" directory is routed text of standart "threads" text.

Thanks for your help. @Burp

QF:
Code:
[url=

Regex:
Code:
#\[url='http://www\.domain\.com/([^./]+)/(.*[^0-9])([0-9][0-9]*).html']([^\[]+)\[/url]#siu

Replace:
Code:
[url=http://www.domain.com/forum/konu/\2.\3]\4[/url]

Again, test before replace. Let me know.
 
Last edited:
Okay i'm testing it, thank you for your excellent help firstly.

When i submit form for testing, i take HTTP 500 Internal Server Error. o_O

I replaced in nearly 1.6 Million Posts something and now I just noticed that on all these posts there is a "Last edited by a moderator"-notice? What can I do?
And how prevent this ?
 
Last edited:
I see I've made a mistake in my last regex, eddited my post (forgot # at beginning and #siu at the end). Are you testing the one with or without the titles?
 
Last edited:
This tool only searches in text in postings. Not titles or anything else. Are you sure that these links actually in postings from users?

The regex I send you should be oke, tested it.
 
I replaced in nearly 1.6 Million Posts something and now I just noticed that on all these posts there is a "Last edited by a moderator"-notice? What can I do?

And how prevent this ?

I can make a guide on how to modify the addon to add one of Jake's tweaks and one of my own if that would help you? (edit silently hides last edit info for posts that had replacements against them and is what I think you both are looking for)
pr_1.1.0.webp
@Burp
When writing regex you will want to say things out with human logic to help wrap your brain around the pattern match you are creating. Doing so will help make more concise or more accurate expressions...for example with your latest expression

delimter
#

blah
\[url='http://www\.domain\.com/

any amount of anything that is not a period or slash followed by a slash
([^./]+)/

zero or more of anything followed by anything that is not a number
(.*[^0-9])

a single number followed by zero or more numbers
([0-9][0-9]*)

literal text(. should be escaped)
.html']

anything that is not a bracket followed by [/url]
([^\[]+)\[/url]

delimiter + flags
#siu



Try using that to see where you can improve upon your expression...hint...you can do both url types with one expression.
 
Last edited:
Thnx EQ, I'll try. I've just learned the very basics of regular expressions myself and try to make them work. I know for sure that there are more easy ways to do. Will do my best :)

And the guide to to modify the addon would be nice ;)
 
No doubt just keep trying and try to keep in mind you want to capture wider ranges of characters as that is the whole power of regex, being able to detect patterns in text (sometimes complex) for viewing or replacement. If I could afford the time at the moment I would try to teach you so that you could take over in this thread here but at the moment I cant, let's see what next week brings.

Would you like me to post up what is a quick working solution for what I believe to be @maxicep 's issue for now so you can try to break it down for your knowledge and so he can keep it on movin with his progress?
 
Back
Top Bottom