AutomationNinja 194 Posted February 10, 2013 Report Share Posted February 10, 2013 Lets say I have a list of phone numbers, http://screencast.com/t/v8JBYdg6 How would I extract just the phone numbers from that list. I tried \\(?\\b[0-9]{3}\\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\\b but no dice. Tried with columns, variables and list to list. Not sure where I am going wrong with this. add list to list(%phone, $find regular expression($text from list(%list, $new line), "\\(?\\b[0-9]{3}\\)?[-. ]?[0-9]{3}[-. ]?[0-9]{4}\\b"), "Delete", "Global") All tips appreciated Thanks, Rob Quote Link to post Share on other sites
pftg4 102 Posted February 10, 2013 Report Share Posted February 10, 2013 found this ^(??:\+?1\s*(?:[.-]\s*)?)?(?:\(\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\s*\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\s*(?:[.-]\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\s*(?:[.-]\s*)?([0-9]{4})(?:\s*(?:#|x\.?|ext\.?|extension)\s*(\d+))?$ Quote Link to post Share on other sites
AutomationNinja 194 Posted February 10, 2013 Author Report Share Posted February 10, 2013 No luck with that either. Here is the code I am using: add item to list(%list, $scrape attribute(<tagname="strong">, "innertext"), "Delete", "Global") add list to list(%phone, $find regular expression($text from list(%list, $new line), "^(??:\\+?1\\s*(?:[.-]\\s*)?)?(?:\\(\\s*([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9])\\s*\\)|([2-9]1[02-9]|[2-9][02-8]1|[2-9][02-8][02-9]))\\s*(?:[.-]\\s*)?)?([2-9]1[02-9]|[2-9][02-9]1|[2-9][02-9]{2})\\s*(?:[.-]\\s*)?([0-9]{4})(?:\\s*(?:#|x\\.?|ext\\.?|extension)\\s*(\\d+))?$"), "Delete", "Global") and the url http://www.lawyers.com/consumer-law/california/all-cities/law-firms-p.html?N=0&r=0&sort=0 Quote Link to post Share on other sites
pftg4 102 Posted February 11, 2013 Report Share Posted February 11, 2013 here you go add list to list(%test, $page scrape("<strong class=\"info_phone\">", "</strong>"), "Delete", "Global") Pftg4 1 Quote Link to post Share on other sites
UBotBuddy 331 Posted February 11, 2013 Report Share Posted February 11, 2013 Did you look at these tuts? http://ubottraining.com/regex/extracting-phone-numbers/http://ubottraining.com/regex/reformatting-phone-numbers/ 1 Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.