Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 13.2 ('Control Animation')
Instant purchase and download via GumRoad!


You're Doing It Wrong

Common Mistakes When Crafting Patterns

Issue: 13.2 (March/April 2015)
Author: Kem Tekinay
Author Bio: Kem Tekinay is a Macintosh consultant and programmer who started with Xojo when it was still REALbasic. He is the author of RegExRX (http://www.mactechnologies.com/index.php:i?page=downloads#regexrx), the popular regular expression editor for Mac and Windows.
Article Description: No description available.
Article Length (in bytes): 12,525
Starting Page Number: 83
Article Number: 13214
Related Web Link(s):


Excerpt of article text...

You have just created a pattern to dissect some complex text. It's a wonder to behold, a thing of beauty, and, if you've used an editor like RegExRX, its colors practically qualify it as artwork.

The only problem is, it doesn't work. It must have a bug in the regular expression engine, right?

Or, just maybe, you have made a basic error that's common to beginners and advanced coders alike. Perhaps it's an error in usage, or one of assumptions, but whatever, there are some "gotchas" to look out for that I'll present here as a series of Do's and Don't's.

DO Keep It Readable

The potential headache with complex patterns often starts with readability. You've created a complex pattern that isn't working, but it's so dense that it's hard to debug even with a dedicated editor. Using free-space mode and comments, as described in the last column, will help a lot here, but so will using tokens that are shorthand for character classes.

To refresh your memory, a character class is a series of characters designated by square brackets that work like an "or" statement. One example might be [123] to mean any numeral that is either "1", "2", or "3". You can create ranges in character classes using a hyphen so [1-3] would mean the same thing.

...End of Excerpt. Please purchase the magazine to read the full article.