Regular Expression (Regex) for Phone Numbers – International and U.S. Formats

I have been looking all over the web for a regular expression to use in JavaScript functions to help with formatting phone number links and printing phone numbers on pages for iPhones, Android, and other mobile devices. This process would naturally affect traditional internet browsers for traditional computers but I went down this path mostly for tracking phone number touch events in Google Analytics on only mobile devices. I finally had the epiphany today that created one expression that covered most international and United States phone number formats.

International and U.S. Phone Number Regular Expression

The red areas, represent the numbered portions. Areas in gray represent the options for spaces, dashes, periods, or sometimes nothing between numbers (e.g. the question marks).
/\d?(\s?|-?|\+?|\.?)((\(\d{1,4}\))|(\d{1,3})|\s?)(\s?|-?|\.?)((\(\d{1,3}\))|(\d{1,3})|\s?)(\s?|-?|\.?)((\(\d{1,3}\))|(\d{1,3})|\s?)(\s?|-?|\.?)\d{3}(-|\.|\s)\d{4}/

Continue reading “Regular Expression (Regex) for Phone Numbers – International and U.S. Formats”

Excel Tidbits: Limiting Meta Descriptions Characters and Words Like Google

I found it hard to find this information on the web, so after a little bit of work I created an Excel formula that mimics the cut off point Google may naturally use when displaying your page’s Meta description in search engine results pages (SERPs). This can come in handy when you are optimizing your site for search engines (SEO). A well written page description is very helpful in improving a site’s click through rate. Depending on your page’s subject and target audience, writing a description in which the page’s story is incomplete or leaves a person hanging improves the searcher’s interest in clicking through. As a result, the last few words of a description could play a large part in creating that situation. But if Google cuts it off too soon or too late, it may be just enough to lose a person’s interest. Continue reading “Excel Tidbits: Limiting Meta Descriptions Characters and Words Like Google”

Excel Tidbits: Extracting Domains from URLs Function

Excel LogoiWorks Numbers LogoI often mash and extract data using Excel. I needed a way to pull out the domain from a web address and compare it with domains from other sheets and activities. This then gives me insight into how often we do work on websites across all our projects.

Version Note: The formula below only works in versions of Excel that can read the xlsx format. Older versions of Excel (pre-2004) are limited to seven nested formulas. This equation has eight. The iserror formulas in the if statements checks for errors and displays whatever is in the A6 cell if an error occurs. If the cell is blank, it should stay blank. I simply used the blank check upfront to make the formula more efficient in processing. Continue reading “Excel Tidbits: Extracting Domains from URLs Function”