Re: Prefixes of regular expressions



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
.



Relevant Pages

  • Re: Help me!! Why java is so popular
    ... String or StringBuffer? ... keep in mind I knew NOTHING about Java. ... The language accepted it, no warnings, and thus I ... in some native assemblers you can peruse the instruction ...
    (comp.lang.java.programmer)
  • Re: question about assigning null to a reference object
    ... String getAuthor() ... void setAuthor ... b.setTitle("Thinking in Java 4th Edition"); ...
    (comp.lang.java.help)
  • Re: Regexp question: Trouble matching with backslash
    ... Backslashes have to be escaped in Java ... regular expression. ... Using an arbitrary String as a regexp is gambling ...
    (comp.lang.java.programmer)
  • Re: Java questions: Urgent
    ... why I would expect almost any Java programmer to be able to answer ... Which is the main reason I "butted" in a bit.. ... on the characters in the String. ... > therefore naturally cover all the basics, or they have missed out badly ...
    (comp.lang.java.programmer)
  • Re: Using Cobol when writing CGIs for the OSU web server.
    ... string safe as well as make slow conversion (as bugs are found and ... The string type approach. ... Because no one has bothered to add it to the "offending" language. ... Java is certainly no replacement for C. ...
    (comp.os.vms)