Regular Expressions, Partial Strings
I am writing data entry routines for an application, and would
like to validate input for a JTextField according to a regular
expression - this means not only validation upon entry of the
whole string (end of edit), but validation with character-by-
The problem is that a partial string is likely to be invalid
according to a regular expression, but not break the rules for
partial matching according to that expression.
If the regular expression is
The string "a" would be neither a partial or whole match.
The string "0" would be a partial match, not a whole one.
The string "00" would be both a partial and a whole match.
I have been using GNU's regular expression package for Java,
(see www.cacas.org/java/gnu/regexp/) which is excellent but
does not seem to provide for validation in this way.
Masks on input (Eg. date is seen as __-__-__) are not
sufficient for my purposes as these enforce length
restrictions on the string, and rarely provide any further
intelligence for validation.
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL