Regular expressions

From: Alexander Schmidt (nospam_at_web.de)
Date: 01/11/04

  • Next message: Pento: "Re: Regular expressions"
    Date: Sun, 11 Jan 2004 00:03:31 +0100
    
    

    Hi,

    short question:

    The regular expression

    a)
    10 + (0 + 11) 0* 1 ( the "+" denotes an OR in our notation and maybe
    replaced by a "|" if you prefer - at least I think that it should be an OR)

    describes these words:
    Either the word 10 OR the word 0 followed by zero or more 0s followed by the
    1 OR the word 11 followed by one or more 0s followed by the 1, ok ?

    Examples:
    10
    0 1
    0 0000000 1
    11 1
    11 00000000 1

    b)
    01 (((10)* + 1111) + 0)* 1

    describes these words:
    The 01 followed by zero or more often the 10 OR the 1111 OR the 0, where the
    10s or the 1111s or the 0s can be repeated zero times or more often. Finally
    the word ends with a 1.
    Okay ?

    Examples:
    01 10 1
    01 10101010 1
    01 1111 1111 1
    01 00000 1
    01 1010 1111 00 1111 1010 1 (we can mix it !)

    I am not sure if I have understood the priorities correctly, so what to
    "execute" first, might someobdy explain them with a few examples perhaps,
    please ?
    What do I have to take care for ?

    So, why can't a generate words like these:
    10 followed by one or more zeros followed by the 1 OR 0 followed by one or
    more 0s followed by the 1 or 11 followed by one or more 0s followed by the 1
    ?
    Would this be: (10+0+11) 0* 1 ?

    So, I do not know in which order to read it and to evaluate the expression,
    the rest is clear.
    Some examples would be great !

    Thanks !


  • Next message: Pento: "Re: Regular expressions"

    Relevant Pages

    • Re: Extract domain names out of URLs
      ... Match the regular expression below and capture its match into backreference ... Between zero and one times, as many times as possible, giving back as needed ... A character in the range between ?A? ...
      (microsoft.public.excel)
    • Regular expressions
      ... I am studying Computer Science and we are currently covering regexps in ... Theoretical CS and I guess you Perl guys should know how to handle them and ... The regular expression ... Either the word 10 OR the word 0 followed by zero or more 0s followed by the ...
      (comp.lang.perl.misc)
    • Re: Regular Expression
      ... > I want to create a regular expression. ... > zero or more of "ScanValRel" ... Prev by Date: ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: vt100 session to pure ASCII ?
      ... The regular expression looks weird because] has a special meaning. ... it would mean repeat the preceding one or more times, ... followed by zero or more non-spaces gets replaced with nothing. ...
      (alt.os.linux)
    • Re: logcheck.violations.ignore --does not work
      ... Peter T. Breuer wrote: ... it would not take care of it. ... Just use a correct regular expression. ... the period character match any single ...
      (comp.os.linux.security)