Re: A question about regexes



On Sun, 07 Oct 2007 04:47:25 +0200, Altu <altu59@xxxxxxxxx> wrote:

Hi

In Java, the following regex:

"a.b"

matches any string that starts with a then any character and then b.

I am trying to create a DFATable for regexes that are in that format.
However the algorithms in the compiler book I have, only support
cases like:

a[a|b]b

but the problem is that the set of allowed symbols are not confined to
a and b in my language.

Is there an equivalent of "a.b" available that is expressible only
using
concatenation, or, and *?

It's a[a|b|c|...]b

where the [...] ranges over all the characters of your alphabet.
Which, depending on the formalism/conventions/... you use for describing your DFA may or may not be "summed up" (eg a transition with no label which consume any one letter, ...)


--
Hypocoristiquement,
Jym.
.



Relevant Pages

  • Re: Is CL good at Text Processing?
    ... Each string contains a list of titles. ... It's Clojure, not Common Lisp, and uses a few Java string-handling methods. ... It AVOIDS using the regexp features of Clojure, since I think that makes a fairer test of how easy it is to do this stuff in Lisp in general. ... String and Character methods. ...
    (comp.lang.lisp)
  • Re: Convert to /
    ... |> Why is it so hard to convert backslashes to forward slashes in java? ... | character immediately after the colon would be the tab ... | get a backslash character into a string literal in Java ...
    (comp.lang.java.help)
  • Re: how do I expand a unicode string to its visual UTF8 representation?
    ... What Java uses internally to represent String ... Java was conceived with Unicode 3.0 in mind, ... which does *not* represent a character ...
    (comp.lang.java.programmer)
  • Re: RegEx issues
    ... The problem is it appears that python is escaping the \ in the regex ... character within a string. ... This flag allows you to write regular expressions that look nicer. ...
    (comp.lang.python)
  • Re: replaceAll with new lines
    ... From the API docs for String.replaceAll(String, ... Note that backslashes and dollar signs in the replacement string ... The first level, performed by the Java ... indicate that the following character is literal rather than a ...
    (comp.lang.java.programmer)