Jump to content
UBot Underground

Is Regular Expression the way to go with this?


Recommended Posts

I have a scraped text that is

 

<h3 class="r"><a href="http://www.domain.com/article/insurance" class="l" onmousedown="return rwt(this,'','','','21','AFQjCNH5_Du8GKgqimnlXXL18fnyNWNi2Q','','0CHMQFjAAOBQ',null,event)"><em>insurance</em> - <em>best deals</em> <b>...</b></a></h3>

 

 

I want to extract whatever the number is which in the above example is '21', but it could be any number from 1 to 100.

 

I don't know what will be in the previous 3 parameters i.e. ,'','','', it could be ,'13','9','something' or even ,'text','text','100'

For the above example I can isolate the parameter I need using ('\d{1,3}')

but that will only work if the first three parameters are going to remain empty, or if they have values that are not numbers.

 

Is there a way that I can get the Reg expression to skip to the 4th comma before searching?

 

Is there a better way to do this?

 

Or is this not a suitable use of Reg expression?

 

 

Any advice would be appreciated

 

Best regards

 

Martin

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...