Scraping using Regex
With Price Comparison Pro, you can scrape using CSS, xPath and Regex. In this KB, you’ll see how to scrape usuing Regex.
Many websites now provide schema.org JSON objects inside their raw HTML which you can scrape with Price Comparison Pro.
Here is an example schema.org JSON object with matching regex:
To grab the price from this, the regex would be:
- First, there are wrapping / characters to contain the expression.
- Next, the identifying marker before the price value. In this case it’s “price”: “
- Then the capturing area inside ( circular brackets ) – in this capturing area we are saying [^”]+.  means any of the characters inside these brackets. The ^ is a special character to say any character except the following character. So [^”] means match any character except a double quote. Matching a double quote would mean we know the price value has ended. Finally, the + after the square brackets says match 1 or more character.
- Then we have the closing ” symbol and finally the closing /
To use Regex in Price Comparison Pro, you do so in the same way you configure CSS or xPath. Visit Settings > Price Comparison Pro > Price Comparison and choose ‘Expression Type’ of RegEXP.