Start a new topic
Answered

What would the Regex code for this link should be like?

Hi,


I have to get info for only authors from one site.


So, the links I want to scrap are in this form:


http://www.name-of-site.com/author/id/slug


example: http://www.name-of-site.com/author/88/matilde-asensi


I want to scrape from this website only links in this form, /author/id/slug...


I don't know how to build that Regex thing...


Anyone can help, please?


Thank you


Best Answer

If the word "author" is fixed in the URL, you could try setting just /author/ or if you want to make it more precise you could try /author/\d+/[\w-]+$, this will match author/digit characters (0-9)/word characters (alphanumerical & underscore)


Answer

If the word "author" is fixed in the URL, you could try setting just /author/ or if you want to make it more precise you could try /author/\d+/[\w-]+$, this will match author/digit characters (0-9)/word characters (alphanumerical & underscore)

Thank you so much Nestor, it worked like a charm!

Thank you very much!

 

You're welcome! :)

Login to post a comment