WordPress Automatic Plugin can scrape the web and grab the desired parts of the content using its Feeds or Multi-page scraper modules but there is a case where the part we want to extract is a simply a part of the picked text
for example in this URL http://ufcstats.com/fight-details/96704d7ba3a452d9 we want the extract the first part “75” only and not the whole part “75 of 128”
If we use the visual selector, the whole text only can be selected
Here is how to only grab the first part of the selected text from the visual selector
- Pick the whole part using the visual selector
- copy the returned xpath to a text editor so we can modify
In my case, the XPath was
/html/body/section/div/div/section[2]/table/tbody/tr/td[3]/p[1]
- Modify the XPath to be
substring-before({copied_Xpath}, ' of')
so the final Xpath issubstring-before(/html/body/section/div/div/section[2]/table/tbody/tr/td[3]/p[1], ' of')
- paste it instead of the one we copied before
This should return the value before of so the final value will be 75 and to get the part after the of text, we can similarly use the substring-after XPath
substring-after({copied_Xpath}, ' of')