Find & replace


#1

I need to find and replace that tag:

 

And here are my config file :

Generated by FiveFilters.org’s web-based selection tool

Place this file inside your site_config/custom/ folder

Source: http://siteconfig.fivefilters.org/grab.php?url=http%3A%2F%2Fauto.ahram.org.eg%2FNews%2F12686.aspx

body: //div[contains(concat(’ ‘,normalize-space(@class),’ ‘),’ img_Block ')]//img | //p

srtip: //div[contains(concat(’ ‘,normalize-space(@class),’ ‘),’ columns ‘) and (contains(concat(’ ‘,normalize-space(@class),’ ‘),’ padding ‘)) and (contains(concat(’ ‘,normalize-space(@class),’ ‘),’ m_m ‘))]//div[contains(concat(’ ‘,normalize-space(@class),’ ‘),’ adv ‘) and (contains(concat(’ ‘,normalize-space(@class),’ ‘),’ hide-for-small '))]//div
strip: //a

#Parser
tidy: yes
parser: html5lib

Clean HTML after procesing

prune: no

test_url: http://auto.ahram.org.eg/News/12686.aspx



#2

Hi Mohammed,

You can use the following to find and replace:

find_string:

 


replace_string:

#3

This would be entered in the txt file that we would create for that specific domain, correct?

Thanks!

Jojo Valdez


#4

Yes, that’s correct. So if you wanted this replacement to happen on all requests to example.org. You would create or edit the site config file example.org.txt and add those lines to it.


#5

Exactly where do we put find_string and replace _string in the txt file? Does it has to be in certain tags or can it be anywhere in that text file? Can we also put html code in the find and replace?

Thanks!


#6

Hi there, they can be anywhere in the text file. But find_string should precede replace_string as they’re treated as a set. You can see examples here https://github.com/fivefilters/ftr-site-config/search?utf8=✓&q=find_string