Re: Prefixes of regular expressions
- From: Roedy Green <see_website@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 30 Jun 2008 05:18:06 GMT
On Sun, 29 Jun 2008 06:24:51 -0700 (PDT), S J Kissane
<skissane@xxxxxxxxx> wrote, quoted or indirectly quoted someone who
said :
Now, the question is, given a regular expression and a string,
how in Java can I determine if the string is a valid prefix of
the regular expression? I have looked at the java.util.regex.Matcher
API in Java SE 6, and I can't see a way of doing this.
the brute force approach is to have a different regex for each length
of string.
Back in the dayso of Java 1.0 I invented a FormattedTextField that
handled a variety of patters, where you described each slot with a
character code.
e.g. 9 numeric A caps a- lower case ...
I had "humps" where you can have decorative punctuation appear e.g.
(604) 871-1166 that you don't key, can't change and is not part of the
final data field.
--
Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com
.
- Follow-Ups:
- Re: Prefixes of regular expressions
- From: Roedy Green
- Re: Prefixes of regular expressions
- References:
- Prefixes of regular expressions
- From: S J Kissane
- Prefixes of regular expressions
- Prev by Date: Limiting RMI to localhost
- Next by Date: Re: Applet Scrollbar and KeyListener
- Previous by thread: Re: Prefixes of regular expressions
- Next by thread: Re: Prefixes of regular expressions
- Index(es):
Relevant Pages
|