Welcome!

You will be redirected in 30 seconds or close now.

ColdFusion Authors: Yakov Fain, Jeremy Geelan, Maureen O'Gara, Nancy Y. Nee, Tad Anderson

Related Topics: ColdFusion

ColdFusion: Article

Validating Input with Regular Expressions

Validating Input with Regular Expressions

Have you ever wished CFINPUT provided a way to validate an e-mail address? Or were you frustrated that its telephone validation didn't allow parentheses around an area code among other such limitations?

Well, your wish has been granted in a new, little-known feature of CF5.

While many will know of the top 10 or so new features in CF5, few will know about the dozens (yes, dozens) of less-promoted enhancements. One of these is the ability to validate user input by way of regular expressions. (If you're new to regular expressions, we'll show you some examples and point you to the CF docs where you can learn more.)

The new feature isn't something that you couldn't do previously, if you knew how to code input validation tests in JavaScript. But, like so many features in CF, the point is that a single tag can solve the problem for you much more easily.

New Capabilities for Tags
What's new is that the CFINPUT and CFTEXTINPUT tags, which are both used within a CFFORM tag, now offer the ability to validate their input using regular expressions. That means you're no longer limited to the validations built into the tags (such as date, time, telephone, zip code, credit card, Social Security number, etc.)

If you're not familiar with these validations, they're quite useful (with some caveats). The CFINPUT tag, for instance, builds JavaScript for you that's sent to the browser to ensure that the user's input for a given field matches an expected pattern for the chosen validation. You can read more about these tags in the CF docs or your favorite CF book (see Sidebar).

Sidebar:
Are you using the CF documentation?

There are lots of great CF books on the market but did you know that CF comes with several very useful manuals? Often, the print version ends up on the shelf of the CF administrator rather than in the hands of CF programmers. If you can get the printed manuals (the set is also available for $50 from Macromedia), they're quite handy and include a reference manual as well as a programmer's guide and more.

They're also available in HTML format by several means: first, they're installed within Studio (one way to reach them is to use the menu command Help>Open Help References Window). They may also be on your CF server (at http://<yourserver>/CFDOCS/dochome.htm), though they shouldn't typically be installed on production servers for security reasons outlined in an Allaire Security Zone bulletin.

The good news is that you can also now find them online at http://livedocs.allaire.com, a new service that also allows you to post comments on each page! Lastly, the docs are also available in PDF format at http://www.allaire.com/developer/documentation/coldfusion.cfm.

Of course, the new capabilities are discussed only in the CF5 docs. If you have not yet installed CF5, you can view the documentation mentioned throughout this article by visiting http://livedocs.allaire.com. Also, if you install the new CF5 update for Studio 4.5.2 (www.macromedia.com/software/coldfusion/resources/ cf_tag_update/contents.html), it will install new help that appears as a new book in the Studio Help feature: "Cold-Fusion 5 (new manuals)."

There's one potential source of confusion, however. While the update does offer new CF5 documentation that covers this new feature as well as new tag insight, tag completion, tag editors, and tag help for most CF5 tags and functions, the tag editor and tag insight features don't include these new attributes for CFINPUT and CFTEXTINPUT. The same is true in CF Studio 5 as of RC1. However, the features do work in CF5.

Getting back to input validation, the built-in validation available for CFINPUT and CFTEXTINPUT has always been somewhat limited (phone numbers had to include an area code, but you couldn't surround them in parentheses) or just nonexistent (there's no built-in validation for e-mail addresses, among other things).

As of Release 5 of CF, you can now create any form of validation you want, if you know how to create the regular expression to describe the pattern that the input should follow. Want to validate Federal Employer Identification Numbers (FEINs, which are not the same format as SSNs)? You can. Want to let people enter phone numbers with or without area codes, and allow parentheses around the area code? You can.

Validating an E-Mail Address
Want to add an e-mail validation? You can do that, too. It's as easy as specifying that the validation will be using regular expressions (using VALIDATE="regular_expression") and then offering the expression in a new PATTERN attribute. Here's an example that will validate e-mail addresses:

 

<CFFORM ACTION="">
Email: <CFINPUT TYPE="Text" NAME="email"
VALIDATE="regular_expression"
PATTERN=" ^([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.
(([a-z]{2,3})|(aero|coop|info|museum|name)))?$"
MESSAGE="Email is improperly formatted">
<INPUT TYPE="Submit">
</CFFORM>

That regular expression in the PATTERN attribute may seem quite daunting. For now, just accept that regular expressions that do something useful may exist - and the cool thing is you can copy them from others to get the benefit.

For example, I borrowed the e-mail matching pattern from one created by Jeff Guillaume for his IsEmail user-defined function offered at the www.CFLib.Org Web site. (If you're not aware of this great repository of user-defined functions run by CF mavens Ray Camden and Rob Brooks-Bilson, do check it out!)

Note that the pattern isn't perfect: for instance, it won't catch if the user types [email protected] (leaving off the c in ".com"). The pattern does allow two or three character domain names (to allow for international domains like ".ca" and ".au".) What may surprise others is that last list of values (.aero, .coop, .info, .museum, .name). These are the newer top-level domain names that have been created recently by the InterNIC. There are still others, but they're either two or three characters.

One other thing to note: it would be best to copy and paste this code rather than try to type it. Regular expressions are pretty picky, and if you get it wrong, you don't generally get an error mesage - the expression just fails to work as expected. For instance, the character used between "aero" and "coop" is a bar (|), not a lowercase letter L (l), nor the number one (1).

How CFFORM Works
I mentioned earlier that using CFINPUT within CFFORM would cause CF to build JavaScript that's sent to the browser on your behalf. That's the cool thing: you don't need to understand JavaScript or how to embed event handlers in your form; CF does it for you. If you want to see the code that's generated, use your browser's View Source or View Page Source menu command. The generated script is a little complicated, but it works and is compliant with all but the oldest browsers.

If the user's input fails whatever validation we've specified in the VALIDATE attribute (or now the optional PATTERN attribute), the form will not be submitted. The user will receive a JavaScript pop-up message (see Figure 1) telling them what's wrong. The message can either be a default one ("Error in fieldname text.") or one that you specify in the MESSAGE attribute, as I have in the example. The bottom line is that they won't be able to proceed past the form until the validated field passes muster.

One of the things some people don't like about the CFINPUT VALIDATE attribute (both the older built-in validation and the new PATTERN-based one) is that users receive the prompt only when they submit the form. The JavaScript that CF builds isn't smart enough to detect the error when users leave the field. It also shows only one message at a time (rather than showing all validation failures at once). Finally, it isn't smart enough to leave the cursor on the field that contains the error users are being told about (which is all the more frustrating since it's only validating one at a time anyway).

If these things really bother you (and they don't have to, if you're validating only a couple of fields), you should know that you can build your own validation to do those things, if you'd like. In fact, the CFINPUT tag offers an ONVALIDATE attribute, in which you name a JavaScript function (that you must write and include on the page) to do some specific validation. If you use this approach, any value in the VALIDATE (or PATTERN) attribute is ignored, but it does indeed give you greater control. Another alternative is the little known PASSTHROUGH attribute, which allows you to pass virtually any attribute/value pair you'd like (including one that uses JavaScript) to be made available on the generated INPUT tag.

Still another thing that dissuades some people from using CFFORM is that they're afraid of its use of Java applets. It's important to clarify here that CFINPUT only uses JavaScript for validation - no Java applets. CFTEXT-INPUT, on the other hand, like several CFFORM subtags, does rely on a Java applet. The applet often provides enhanced control over the user interface (in fact, Release 5 of CF offers many new enhancements to these Java-enabled features), but using Java on the client does have its disadvantages, so some are afraid to use it.

And despite what some may think, using CFFORM will not always cause the applet support files to load: they're loaded only when you use one of the applet-based subtags. But CFINPUT doesn't use Java - it uses JavaScript. Big difference.

There is still another potential issue: not all browsers support JavaScript (and some users have it disabled intentionally for security concerns). Still, there's no harm in using this feature if JavaScript isn't enabled. The JavaScript built by CFINPUT is written in such a way that if the browser doesn't support JavaScript, it will simply be ignored.

Of course, that means you shouldn't rely solely on the JavaScript validation since data coming from a browser that doesn't support it won't be validated. You need to also validate it on the server. A cool thing is that you can generally use these same JavaScript regular expression patterns in the CFML code that processes the form, using them in the REFind or RE-FindNoCase functions. More about these in a moment.

One last thing to note about our use of CFFORM in the preceding example: I used an empty string for the form's ACTION attribute value. CFFORM requires an ACTION attribute. It can't be left off, and even though in this particular example it doesn't really matter where we submit to, we have to provide one. Since we're only interested in observing the behavior when we try to submit it, I left the action blank so the page will just call itself. Of course, you should name the action page of whatever CF page will process the form.

About Regular Expressions
So how about that regular expression? What does "^([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name)))?$" mean? It may look a little confusing, but with a little knowledge, looking at a new pattern starts to make sense quite quickly. I can't offer a tutorial on regular expressions, or regexps, as they're also known, in this article, but I can show you where to learn more.

And what are regexps, anyway? They've actually been around for a long time and extend well beyond ColdFusion (and JavaScript). In fact, they're more strongly supported and more widely used in the UNIX operating system, but they've found their way into many more tools since they provide a powerful way to perform matching against a pattern, whether simple or complex. Obviously, the preceding pattern looks rather complex. There is even an entire book on the subject, called Mastering Regular Expressions, by Jeffrey E. Friedl (O'Reilly).

The good news is that Macromedia has provided some bolstered documentation of them just for this specific new feature, in the second section of Chapter 9 ("Building Dynamic Forms") in the Developing ColdFusion Applications manual. The old name was Developing Web Applications with ColdFusion.

The manual does have some coverage of regexps, as does the CFML Reference, but it's important to note that some of the coverage there is about ColdFusion's supported regexp syntax. What do I mean by that? It's another source of confusion.

ColdFusion Regular Expressions?
Prior to Release 5 (and still supported in CF5), there are several features in ColdFusion (and Cold-Fusion Studio) that leverage regular expressions already. They include the REFind and REFindNoCase functions, as well as REReplace and REReplace NoCase. Each of these performs a find or replace (case sensitive or not), respectively, using regexps, as do the Extended Find and Extended Replace features in Studio (under the Search menu). The CFLDAP tag's FILTER attribute also uses them.

These CF-enabled features, however, use a regular expression syntax that Allaire built into ColdFusion. The syntax supported is indeed documented in the CF manuals. In CF5, it's the Developing ColdFusion Applications manual, Chapter 14, "Using Regular Expressions in Functions." In fact, this documentation is greatly improved over the documentation in previous releases (there was no similar chapter).

Take note, however: this CF-specific version of regular expressions isn't a complete rendering of regular expressions as is used in UNIX or even JavaScript. And that's a key point for the purposes of this article: the regular expressions used in CFINPUT's PATTERN attribute are JavaScript regular expressions, passed verbatim to the client and interpreted on the browser.

But they're similar enough, and as was mentioned, the new documentation does offer a brief rundown (in Chapter 9 of that book) of some typical JavaScript regular expression syntax that might be used in the CFINPUT PATTERN attribute. The discussions are more complete in Chapter 14, and it's not too difficult to apply what's learned in one chapter to the equivalent features described in the other.

So, I'll leave it to your exploration of the docs to learn what the regular expression "^([_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name)))?$" used above means.

Be sure to carefully test your use of regular expressions in the environment in which you will deploy them. For the most part, if a regexp works in one browser, it will work in all of them. Note that the CF regular expressions (used in the functions) offer a format called POSIX-compliant regexps. These should not be used in the CFINPUT PATTERN since they'll be passed down to the browser and my testing suggests they're not supported in JavaScript (at least they weren't in my Internet Explorer 5.5).

Some Advanced RegExp Tips
I'd like to add a couple of comments for the benefit of more experienced regexp developers. First, note that I have not used the opening and closing slash ("/") that you may be used to using to delineate an expression. That's because, if you look at the JavaScript created by CF, it's putting those in for you. If you add them as well, it will make the pattern fail. Forewarned is forearmed.

Second, note that I've wrapped the entire pattern (other than the start/end characters, ^ and $) in parentheses. More important, I've followed that closing parenthesis with a "?". This is important as it indicates that the pattern being sought can occur either 0 or 1 time. If you leave that off, then you'll perhaps inadvertently indicate that an e-mail address is required. If none is entered, the pattern won't match and the validation will fail.

You may indeed want to require that a value be entered, but there's an available REQUIRED attribute for the CFINPUT that will make it more clear to someone looking at your code that you're requiring an input value. I just mention this because if you didn't think to add it (the ()? around the pattern), it would fail even if no value was entered and you may be quite confused by that. (Okay, if you're really experienced with regexps, maybe not!)

Finally, keep in mind that in the case of both kinds of regexps (used in the CF functions or in CFINPUT's PATTERN attribute), it's certainly acceptable to use ColdFusion variables and other expressions to create the values to be used in the regexp. The CF expressions are interpreted by CF before the regular expression is then interpreted, so you can use form and query variables, and so on, to help build your regexp.

Validating Phone Numbers
I mentioned at the opening that the built-in VALIDATE="telephone" is limited in some ways (forcing the user to provide an area code and not allowing parentheses around the area code). Here's a pattern that gets around those problems and still adds some other value:

^((\(?[1-9][0-9][0-9]\)?)?\s?[1-9][0-9][0-9]\s?\d{4})?$

It, too, isn't perfect. It doesn't support international area codes, nor numbers formatted in other than the typical U.S. format for phone numbers of three-digit area codes, three-digit exchanges, and four remaining numbers. But while it does allow parentheses, dashes, and spaces, it doesn't require them. More experienced regexp users may wonder why I didn't just use "\d{3}" for the pattern to search for the three digits of the area code and exchange (the first three of the last seven numbers). The problem is that this wouldn't ensure they didn't start at zero, which is another rule for U.S. telephone numbers (for now, anyway).

Closing Thoughts
As I noted before, you don't need to understand these patterns in detail to benefit. Just go ahead and use them.

Maybe eventually there will be a repository of patterns that can be used in a variety of ways, including the PATTERN attribute, the RE functions, Studio, and even more fancy user-defined functions, such as the IsEmail from which I got the example e-mail pattern.

Better still, perhaps you'll be motivated to create other patterns to solve common problems, to offer to such a repository, or to simply solve your own challenges. I hope this quick tutorial on a new way to use them in CF5 motivates you to consider them, or at least be able to benefit from those who do.

Additional Resources

  1. To learn more about adding your own validation, see Selene Bainum's article, "Extending CFFORM with Customized JavaScript Validation" (CFDJ, Vol. 2, issue 8) at www.sys-con.com/coldfusion/article.cfm?id=141.
  2. To learn more about JavaScript in general, see my article, "Getting Focus(ed)" (CFDJ, Vol. 2, issue 6) at www.sys-con.com/coldfusion/article.cfm?id=122.
  3. To learn more about doing form and input validation with CF, see Kailasnath Awati and Mario Techera's article, "Some Thoughts on the Design of CF Data Input Applications" (CFDJ, Vol. 3, issue 3), at www.sys-con.com/coldfusion/article.cfm?id=234.

More Stories By Charlie Arehart

A veteran ColdFusion developer since 1997, Charlie Arehart is a long-time contributor to the community and a recognized Adobe Community Expert. He's a certified Advanced CF Developer and Instructor for CF 4/5/6/7 and served as tech editor of CFDJ until 2003. Now an independent contractor (carehart.org) living in Alpharetta, GA, Charlie provides high-level troubleshooting/tuning assistance and training/mentoring for CF teams. He helps run the Online ColdFusion Meetup (coldfusionmeetup.com, an online CF user group), is a contributor to the CF8 WACK books by Ben Forta, and is frequently invited to speak at developer conferences and user groups worldwide.

Comments (2) View Comments

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Most Recent Comments
Kris Symer 04/08/05 01:15:04 PM EDT

My coworker and I refined the email script so it would work for upper and lowercase letters in an optional cfinput field (required="no"):

pattern="^([_A-Za-z0-9-]+(\.[_A-Za-z0-9-]+)*@[A-Za-z0-9-]+(\.[A-Za-z0-9-]+)*\.(([A-Za-z]{2,3})|(aero|AERO|coop|COOP|info|INFO|museum|MUSEUM|name|NAME)))?$"

charles arehart 08/01/02 05:47:00 PM EDT

Folks, I have found that there were a couple of errors in the expressions offered here. Please use the following instead.

For email:

^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$

For phone:

^((\(?[1-9][0-9][0-9]\)?)?\s?[1-9][0-9][0-9]\s?\d{4})?$

Sorry for the inconvenience.

@ThingsExpo Stories
Connected devices and the industrial internet are growing exponentially every year with Cisco expecting 50 billion devices to be in operation by 2020. In this period of growth, location-based insights are becoming invaluable to many businesses as they adopt new connected technologies. Knowing when and where these devices connect from is critical for a number of scenarios in supply chain management, disaster management, emergency response, M2M, location marketing and more. In his session at @Th...
"Dice has been around for the last 20 years. We have been helping tech professionals find new jobs and career opportunities," explained Manish Dixit, VP of Product and Engineering at Dice, in this SYS-CON.tv interview at 19th Cloud Expo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
What happens when the different parts of a vehicle become smarter than the vehicle itself? As we move toward the era of smart everything, hundreds of entities in a vehicle that communicate with each other, the vehicle and external systems create a need for identity orchestration so that all entities work as a conglomerate. Much like an orchestra without a conductor, without the ability to secure, control, and connect the link between a vehicle’s head unit, devices, and systems and to manage the ...
"We're a cybersecurity firm that specializes in engineering security solutions both at the software and hardware level. Security cannot be an after-the-fact afterthought, which is what it's become," stated Richard Blech, Chief Executive Officer at Secure Channels, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
In addition to all the benefits, IoT is also bringing new kind of customer experience challenges - cars that unlock themselves, thermostats turning houses into saunas and baby video monitors broadcasting over the internet. This list can only increase because while IoT services should be intuitive and simple to use, the delivery ecosystem is a myriad of potential problems as IoT explodes complexity. So finding a performance issue is like finding the proverbial needle in the haystack.
In his keynote at 18th Cloud Expo, Andrew Keys, Co-Founder of ConsenSys Enterprise, provided an overview of the evolution of the Internet and the Database and the future of their combination – the Blockchain. Andrew Keys is Co-Founder of ConsenSys Enterprise. He comes to ConsenSys Enterprise with capital markets, technology and entrepreneurial experience. Previously, he worked for UBS investment bank in equities analysis. Later, he was responsible for the creation and distribution of life sett...
The WebRTC Summit New York, to be held June 6-8, 2017, at the Javits Center in New York City, NY, announces that its Call for Papers is now open. Topics include all aspects of improving IT delivery by eliminating waste through automated business models leveraging cloud technologies. WebRTC Summit is co-located with 20th International Cloud Expo and @ThingsExpo. WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web ...
20th Cloud Expo, taking place June 6-8, 2017, at the Javits Center in New York City, NY, will feature technical sessions from a rock star conference faculty and the leading industry players in the world. Cloud computing is now being embraced by a majority of enterprises of all sizes. Yesterday's debate about public vs. private has transformed into the reality of hybrid cloud: a recent survey shows that 74% of enterprises have a hybrid cloud strategy.
Internet-of-Things discussions can end up either going down the consumer gadget rabbit hole or focused on the sort of data logging that industrial manufacturers have been doing forever. However, in fact, companies today are already using IoT data both to optimize their operational technology and to improve the experience of customer interactions in novel ways. In his session at @ThingsExpo, Gordon Haff, Red Hat Technology Evangelist, will share examples from a wide range of industries – includin...
WebRTC is the future of browser-to-browser communications, and continues to make inroads into the traditional, difficult, plug-in web communications world. The 6th WebRTC Summit continues our tradition of delivering the latest and greatest presentations within the world of WebRTC. Topics include voice calling, video chat, P2P file sharing, and use cases that have already leveraged the power and convenience of WebRTC.
"We build IoT infrastructure products - when you have to integrate different devices, different systems and cloud you have to build an application to do that but we eliminate the need to build an application. Our products can integrate any device, any system, any cloud regardless of protocol," explained Peter Jung, Chief Product Officer at Pulzze Systems, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
Data is the fuel that drives the machine learning algorithmic engines and ultimately provides the business value. In his session at 20th Cloud Expo, Ed Featherston, director/senior enterprise architect at Collaborative Consulting, will discuss the key considerations around quality, volume, timeliness, and pedigree that must be dealt with in order to properly fuel that engine.
"Once customers get a year into their IoT deployments, they start to realize that they may have been shortsighted in the ways they built out their deployment and the key thing I see a lot of people looking at is - how can I take equipment data, pull it back in an IoT solution and show it in a dashboard," stated Dave McCarthy, Director of Products at Bsquare Corporation, in this SYS-CON.tv interview at @ThingsExpo, held November 1-3, 2016, at the Santa Clara Convention Center in Santa Clara, CA.
IoT is rapidly changing the way enterprises are using data to improve business decision-making. In order to derive business value, organizations must unlock insights from the data gathered and then act on these. In their session at @ThingsExpo, Eric Hoffman, Vice President at EastBanc Technologies, and Peter Shashkin, Head of Development Department at EastBanc Technologies, discussed how one organization leveraged IoT, cloud technology and data analysis to improve customer experiences and effici...
Fact is, enterprises have significant legacy voice infrastructure that’s costly to replace with pure IP solutions. How can we bring this analog infrastructure into our shiny new cloud applications? There are proven methods to bind both legacy voice applications and traditional PSTN audio into cloud-based applications and services at a carrier scale. Some of the most successful implementations leverage WebRTC, WebSockets, SIP and other open source technologies. In his session at @ThingsExpo, Da...
"IoT is going to be a huge industry with a lot of value for end users, for industries, for consumers, for manufacturers. How can we use cloud to effectively manage IoT applications," stated Ian Khan, Innovation & Marketing Manager at Solgeniakhela, in this SYS-CON.tv interview at @ThingsExpo, held November 3-5, 2015, at the Santa Clara Convention Center in Santa Clara, CA.
As data explodes in quantity, importance and from new sources, the need for managing and protecting data residing across physical, virtual, and cloud environments grow with it. Managing data includes protecting it, indexing and classifying it for true, long-term management, compliance and E-Discovery. Commvault can ensure this with a single pane of glass solution – whether in a private cloud, a Service Provider delivered public cloud or a hybrid cloud environment – across the heterogeneous enter...
The cloud promises new levels of agility and cost-savings for Big Data, data warehousing and analytics. But it’s challenging to understand all the options – from IaaS and PaaS to newer services like HaaS (Hadoop as a Service) and BDaaS (Big Data as a Service). In her session at @BigDataExpo at @ThingsExpo, Hannah Smalltree, a director at Cazena, provided an educational overview of emerging “as-a-service” options for Big Data in the cloud. This is critical background for IT and data professionals...
Today we can collect lots and lots of performance data. We build beautiful dashboards and even have fancy query languages to access and transform the data. Still performance data is a secret language only a couple of people understand. The more business becomes digital the more stakeholders are interested in this data including how it relates to business. Some of these people have never used a monitoring tool before. They have a question on their mind like “How is my application doing” but no id...
@GonzalezCarmen has been ranked the Number One Influencer and @ThingsExpo has been named the Number One Brand in the “M2M 2016: Top 100 Influencers and Brands” by Onalytica. Onalytica analyzed tweets over the last 6 months mentioning the keywords M2M OR “Machine to Machine.” They then identified the top 100 most influential brands and individuals leading the discussion on Twitter.