Got a block of text I'm trying to pull phone numbers out of.
for example:
Phone Numbers
Any phone numbers that Angelo may currently or previously have used
are displayed below. Run a phone report on a particular number for
more information.
(555) 444-5555 (555) 555-7777 Not seeing something? Access additional
data sources. Accessing premium data sources may reveal hard to find
phone numbers like cell phones
the regex code I wrote to extract the numbers is
.?\d{3}.?\s\d{3}.\d{4}
For whatever reason, the results turn back blank and I'm not sure why. I've tested this regex code inside a uBot Expresion Checker and it pulls the phone numbers out as it should. But once I enter it in uBot it pulls nothing.
Any help? Thanks
FIGURED IT OUT:
.*\d3.?\s\d{3,5}.\d{3,5}
for whatever reason uBot wouldn't display the phone numbers correctly until I had the above worked out.
Related
As the title says, what is the process to applying a customValidate regex in vue-tel-input? You can see customValidate as the last item in the list of props. I have a standard setup like in this code sandbox. However, when I add a regex for the phone number to only allow a phone number with digits and a starting "+", the code hangs and kills my browser, customValidate: /^\+\d+$/. Is my formatting correct or is there another approach I should take? Is my regex ok?
I'm trying to validate the format of a street address in Google Forms using regex. I won't be able to confirm it's a real address, but I would like to at least validate that the string is:
[numbers(max 6 digits)] [word(minimum one to max 8 words with
spaces in between and numbers and # allowed)], [words(minimum one to max four words, only letters)], [2
capital letters] [5 digit number]
I want the spaces and commas I left in between the brackets to be required, exactly where I put them in the above example. This would validate
123 test st, test city, TT 12345
That's obviously not a real address, but at least it requires the entry of the correct format. The data is coming from people answering a question on a form, so it will always be just an address, no names. Plus they're all address is one area South Florida, where pretty much all addresses will match this format. The problem I'm having is people not entering a city, or commas, so I want to give them an error if they don't. So far, I've found this
^([0-9a-zA-Z]+)(,\s*[0-9a-zA-Z]+)*$
But that doesn't allow for multiple words between the commas, or the capital letters and numbers for zip. Any help would save me a lot of headaches, and I would greatly appreciate it.
There really is a lot to consider when dealing with a street address--more than you can meaningfully deal with using a regular expression. Besides, if a human being is at a keyboard, there's always a high likelihood of typing mistakes, and there just isn't a regex that can account for all possible human errors.
Also, depending on what you intend to do with the address once you receive it, there's all sorts of helpful information you might need that you wouldn't get just from splitting the rough address components with a regex.
As a software developer at SmartyStreets (disclosure), I've learned that regular expressions really are the wrong tool for this job because addresses aren't as 'regular' (standardized) as you might think. There are more rigorous validation tools available, even plugins you can install on your web form to validate the address as it is typed, and which return a wealth of of useful metadata and information.
Try Regex:
\d{1,6}\s(?:[A-Za-z0-9#]+\s){0,7}(?:[A-Za-z0-9#]+,)\s*(?:[A-Za-z]+\s){0,3}(?:[A-Za-z]+,)\s*[A-Z]{2}\s*\d{5}
See Demo
Accepts Apt# also:
(^[0-9]{1,5}\s)([A-Za-z]{1,}(\#\s|\s\#|\s\#\s|\s)){1,5}([A-Za-z]{1,}\,|[0-9]{1,}\,)(\s[a-zA-Z]{1,}\,|[a-zA-Z]{1,}\,)(\s[a-zA-Z]{2}\s|[a-zA-Z]{2}\s)([0-9]{5})
I was tasked with making an Excel spreadsheet where MAC addresses and directory numbers would be added later. The task, though, was to idiot-proof it somehow.
That is, for the MAC addresses:
Only allow the characters 0 - 9 and a - f
Must have 12 characters
and for the directory number
- 10 digits
If any of these criteria fail, display an error.
I've been trying to play with regex and data validation, and I'm just not having any luck. I've been googling any combination of excel mac address regex limiting as terms and not gotten much further.
TL;DR I need to check whether entered phone numbers and MAC addresses are properly formatted when entered in a cell.
For the MAC address: [0-9a-f]{12}
For the directory number: \d{10}
See this answer by allquixotic for how to use these patterns in Excel, but substitute the correct regex.
As the comments mentioned though, idiot proof is going to be an unreachable goal.
I would like to add a phone number to a word document that I generate using the mso api.
In word, when one writes (Tel:00493298402938) and new line, the phone number is activated automatically.
While trying to record the corresponding macro and check the VBA code, it doesn't show the same behavior and the phone number is interpreted as a normal text.
Any helpful source code in VBA, C# or C++ is welcome.
Thanks!
Maybe the following code would be helpful to you?
ThisWorkbook.ActiveSheet.Hyperlinks.Add Range("A1"), "http://stackoverflow.com"
Just instead of the web address you would need the phone number.
Hey, folks. I'm looking for some regular expressions to help grab street addresses and phone numbers from free-form text (a la Gmail).
Given some text: "John, I went to the store today, and it was awesome! Did you hear that they moved to 500 Green St.? ... Give me a call at +14252425424 when you get a chance."
I'd like to be able to pull out:
500 Green St. (recognized as a street address)
+14252425424 (recognized as a phone number)
What makes this problem easier is that I don't care about parsing text that gets pulled out. That is, I don't care that Green is the name of the road or that 425 is the area code. I just want to grab strings that "look like" addresses or telephone numbers.
Unfortunately, this needs to work internationally, as best as possible.
Anyone have any leads? Thanks!
Phone numbers as long as you have a list of all country codes and number formats is easy, street addresses I have no idea, the only advice I can give you is to validate each set of words # addressdoctor.com
You can give RecogniContact (-> address-parser.com) a try, it recognizes both postal addresses and phone numbers.
Take a look at Chapter 7 of Dive Into Python. It touches both phone numbers and street addresses. I believe you can use this as a starting point. The international part seems tough. I suggest you build a first draft, try it on several locales, iterate and improve.