Jump to content
UBot Underground

Trying to scrape using regex, but it does not work.


Recommended Posts

Hi there, anyone could help me with this code?  thks

 

 

comment("Need this phone numbers in a list:")
load html("<p class=\"abac0\">(005) 376-6780</p>
<p class=\"abcs2\">(005) 376-6781</p>
<p class=\"afbc4\">(005) 376-6782</p>
<p class=\"abgc5\">(005) 376-6783</p>
<p class=\"abhc6\">(005) 376-6784</p>
<p class=\"abcj8\">(005) 376-6785</p>")
comment("I tried using these 2 regex codes, but they dont work")
add list to list(%phone0$find regular expression($scrape attribute($element offset(<tagname="body">, 0), "innertext"), "\\([0-9]3\\)[-. ]?[0-9]3[-. ]?[0-9]4\\b"), "Delete""Global")
add list to list(%phone1$find regular expression($scrape attribute($element offset(<tagname="body">, 0), "innertext"), "\\(\\d*\\) \\d*-\\d{4}"), "Delete""Global")

Link to post
Share on other sites

Can you say more about it? What exactly are you trying to scrape or will it show up exactly like this? It matters a lot in regex so knowing where it came from and what it is helps a lot. Are you really going to be getting them from a load html?

Link to post
Share on other sites

Nope, I am getting it from a website.  The problem is even though the regex code woks (I checked on regex hero and Edit Pad Pro), after running the script the list is empty.  Thanks for yuor help.

 

Okay, it's not Ubot friendly regex though (not your fault) - try this - not in code view though, just in the regex box.

 

\(\d{3,3}\)\s\d{3,3}\-\d{4,4}

  • Like 1
Link to post
Share on other sites

Okay, it's not Ubot friendly regex though (not your fault) - try this - not in code view though, just in the regex box.

 

\(\d{3,3}\)\s\d{3,3}\-\d{4,4}

You did it.  Thank you so much.  But my last question is, what is "ubot friendly"?  I just learning about regex, so everything is new for me.  Thanks again.

Link to post
Share on other sites

You did it.  Thank you so much.  But my last question is, what is "ubot friendly"?  I just learning about regex, so everything is new for me.  Thanks again.

 

Glad to hear it! Well, that's a tough question to answer. But you did trip upon one of the most important issues which is that using {3} would not work so you have to use {3,3} which will work in any other regex tester but so would the original {3} whereas that would not work in Ubot.

  • Like 1
Link to post
Share on other sites

Glad to hear it! Well, that's a tough question to answer. But you did trip upon one of the most important issues which is that using {3} would not work so you have to use {3,3} which will work in any other regex tester but so would the original {3} whereas that would not work in Ubot.

Got it.  1000s Thanks.  =)

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