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”

Why WordPress Main Menu Navigation is Missing from Categories

Often I am converting old WordPress sites or working with custom page or post types. When you try to force something other than posts to show in category pages, the main navigation menus fail to display. The core WordPress wp_nav_menu() function doesn’t know what to do in those cases and returns nothing.

Code Solution:

if(is_category()) {
$thiscat_id=get_query_var('cat');
$backup=$wp_query;
$wp_query = NULL;
$wp_query = new WP_Query(array('post_type' => 'any'));  }
wp_nav_menu( $defaults );
if($thiscat_id!="") { $wp_query=$backup; }

Continue reading “Why WordPress Main Menu Navigation is Missing from Categories”

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: Creating Column Header Rows for Sorting

Apple/Mac MS Excel Column Header Selection Using Filters

Well, sad to say this one has stumped me for a long time. I work in Numbers from Apple’s iWorks Suite about as much as I do in Excel. Data sets above about 1000 rows, assuming use of processor-heavy formulas like vlookups, really slow Numbers down. From a visual and formula perspective, Numbers is much easier to use. One of my favorite aspects is the ability to create header rows so that the last row becomes the column headers and the references in formulas. That makes modifying data quicker and improves one’s ability to keep track of a greater variety of segments. Continue reading “Excel Tidbits: Creating Column Header Rows for Sorting”

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”

Behavioral Ad Targeting Debate

An article by eMarketer spread word on a new study saying people don’t want targeted ads. Earlier studies say differently. How conductors educate the participants within and around questions is just as important as the actual question itself. Context can easily change meaning. Even the order of questions affects respondent perception and subsequent answers. Issues in this conclusion (i.e. data security and customization) need to be approached separately at first and combined down the questionnaire so that customers prioritize their opinion aptly and fears controlled.

My opinion remains unchanged. Customers dislike loosing control of their personal information, yet appreciate customization services. If we communicate our responsibility to protect their information, they will appreciate the benefits we serve and their purchases and activity will speak that message. Continue reading “Behavioral Ad Targeting Debate”

Importing Audio Books into Your iPod

Okay, so this isn’t web related, but it’s important enough to put it out there.

Working for a book publisher and owning an iPod and liking audio books means I want audio books on my iPod. Thomas Nelson has many audio book products (fictionnonfictionbiblesgift booksSpanish). If I don’t buy audio books off iTunes or Audible, then I have to import them from MP3 CDs or audio CDs. The problem with iTunes is that Apple didn’t really consider the process of importing audio books. Instead, iTunes treats any audio file like a music file unless it has an M4B extension (as of iTunes 7.6 and earlier versions). M4B is Apple’s audio book file format.

What You Really Need to Know: If you change the extension of any AAC file (mp4 or m4a) to M4B and add the files to your iTunes library, it automatically applies its audio book features to the file. There is no special encoding to the file needed. Continue reading “Importing Audio Books into Your iPod”

We Are Media

I cannot authoritatively speak for all of us, but from what I have seen, we in the print publication industries find it hard to include digital products in our business. But I think it’d be no surprise to all of us that if we don’t consider publishing more digital products in the near future, our business will be on track for exinction.

But I want to take the concept farther. If we don’t intricately integrate digital publishing into our publishing process and product concepts, we will eventually fail in the dust of other publishers who do. And I’m not looking 10 years down the line as we may naturally feel it is. It’s much, much closer.

I’d like to give some basics to be sure we are on the same page. When I speak about digital publishing, I’m not talking about creating a book or magazine in Adobe InDesign or Quark and then having it printed out. I’m talking about two general concepts. Continue reading “We Are Media”

Trusted Sources of Information

In a growing Web 2.0 world, consumer-generate content is becoming a staple for successful sites and sales. This is a big advantage for word of mouth marketing (WOMM) and those of us interested in using it. But as a novice in this area, you may not be sure what mediums to start with. eMarketer posted an article today with studies indicating people’s most trusted sources and where influencers flock.

As I say in most of my posts, identifying the niche for your product is most important place to begin. The niche(s) determines the subject of your messages and where you go to advertise your product. This perspective still applies with word of mouth marketing.

Information in the following charts can help us understand where consumers trend. We can use the information to choose where to begin our word of mouth campaign or even our general advertising.

We all know family and friends typically give us our most trusted information. The following graph presents consumer-trusted sources by popularity. When thinking about your WOM or advertising campaign, your goal is to get people on board with the following type of classifications or experiences.


People spread the word about a product with varying intensities. The most intense word-of-mouth communicators or “influencers” are the most attractive. One major component of WOMM sometimes crosses with publicity by attracting key persons to review your product and talk about it in articles or on their blogs. The chart bellow from eMarketer, based on a 2006 study, identifies key places influencers go to get their information. The first column, adult influencers, represents key influencers who shape consumer attitudes.


If you want to attract key people to your product, locations in the chart above is where you should start either advertising or request them to review your product.

For those of us who don’t think our product is excellent or that flaws in the product will be learned quickly, I suggest not advertising in some of the locations above. If your product is sub-par, people in these places will be the first to find that out and potentially spread the information on how much your product fails. That statement may seem unethical, but most of us at some point represent products we don’t have in confidence. Yet, we still want to do our best to make it sell as best as possible. Word of mouth marketing doesn’t work positively for weak products. The word will get out about its ineffectiveness (or people will simply not say anything about it). But, it’s possible to slow down the discovery and get strong initial buy-in using other traditional forms of marketing.