Jump to content
UBot Underground

newbie needs help with simple regex


Recommended Posts

Guys can anyone help me with this stuff?

 

htmlblabla12343refikririrnrhtmlllllsskksjksjsjsjdjijfiejfiejfiefjeijfeijfiejfiejfiejfeijfjeicminiaooasoasoaoaa

htmlblabla www.autotrader.com/p/for-sale/new-peugeot-diesel-white/1037414207"wegegegehtml

htmlblabla www.autotrader.com/p/for-sale/renault-clio-blue-for-repair/1037768565"ergergerg4g4ghtml

htmlblabla www.autotrader.com/p/for-sale/wanted-renault-megane-yellow/1037768565"ergegegeehtml

htmlblabladfvervrvrtbrefikririrnrhtmlllllsskksjksjsjsjdjijfiejfiejfiefjeijfeijfiejfiejfiejfeijfjeifrgbrtoasoasoaoaa

 

I use this the formula to scrape all links from website's html 

 

(www[.]autotrader[.]com\/p\/)[^"]+

 

this formula let's me scrape only links starting with www.autotrader.com/p/ and all characters after that until " 

it works perfectly with one BUT please have a look on those 3 links, the bottom one has a word ,,wanted,, in it, and middle one has ,,for repair,,

WHAT's THE FORMULA to scrape only all links that have NO words ,,wanted,, ,,repair,, (for repair?) in it, so as a result I should get only link number one scraped to the list in ubot, I hope you know what I mean. Please help ;)

 

Link to post
Share on other sites

Hi,

 

Regex code to select url with the word new in it:

(www[.]autotrader[.]com\/p\/.*new[^"]+)

Regex code to select url without the words repair and wanted:

(?!.*repair|.*wanted)(www[.]autotrader[.]com\/p\/[^"]+)

Kevin

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...