Article Preview
Buy Now
COLUMN
Literally, Literal Patterns
Turning Arbitrary Strings Into Regular Expression Patterns
Issue: 13.1 (January/February 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): 11,106
Starting Page Number: 92
Article Number: 13112
Related Web Link(s):
http://www.mactechnologies.com/index.php
Excerpt of article text...
Regular expressions can save you a lot of time and effort, make your code easier to read and maintain, and generally improve your coding life. Literally.
Learn them well and you will become a programming rock star. Literally.
Well, maybe the "rock star" thing is more "figurative," but could you tell the difference? Sure, the first lists things that could happen in a real, measurable sense, whereas the latter is something that represents an idea open to interpretation.
But how do you tell the regular expression engine when to take a pattern literally instead of interpreting it as tokens?
The Unknown Pattern
Suppose you wanted to let your users define a pattern from within your application. For example, they can search a
TextArea
, but that search will yield entire lines or paragraphs that hold their specified string.
...End of Excerpt. Please purchase the magazine to read the full article.