Software Secret Weapons™
|
Regular Expressions |
|||
|
It is well known that regular expressions are hard to use. Your head just hurts...
Let's say we have the series of strings to parse: ${32.82}, ${we5}, ${x4Rvc}, ${123}. It is clear that we are looking for: ${x*}. But the proper regular expression is actually much more complicated:
Pattern myPattern = Pattern.compile("\\{\\$(\\w*)\\}");
The complexity arrises from the escaping of characters. Some characters have ordinary meaning to you, but have special meaning in the context of regular expression engine. There are many special characters There is an easier way! Several products like Lapis were created to overcame this problem. incomplete |
|
|||
|
Copyright © 2004-2010 by Pavel Simakov any conclusions, recommendations, ideas, thoughts or the source code presented on this site are my own and do not reflect a official opinion of my current or past employers, partners or clients |
|
No comments yet
Leave a comment