Regular Expression - Networking

This is a discussion on Regular Expression - Networking ; Sorry, this may not be the best newsgroup, but it is the most Linux savvy of any I know. I'm trying to figure out a regular expression to match a line with more than 2 '-' characters in it. Is ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Regular Expression

  1. Regular Expression

    Sorry, this may not be the best newsgroup, but it is the most Linux savvy
    of any I know.

    I'm trying to figure out a regular expression to match a line with more
    than 2 '-' characters in it. Is this possible?

    Dan

  2. Re: Regular Expression

    "Dan N" wrote in message
    news:47faef10$0$13273$5a62ac22@per-qv1-newsreader-01.iinet.net.au...
    > Sorry, this may not be the best newsgroup, but it is the most Linux savvy
    > of any I know.
    >
    > I'm trying to figure out a regular expression to match a line with more
    > than 2 '-' characters in it. Is this possible?


    (.*)-(.*)-(.*)-(.*)

    I don't recall offhand how to collapse that further for the 3 repetitions of
    "-(.*)" but the above should work.



  3. Re: Regular Expression

    On Mon, 07 Apr 2008 21:17:09 -0700, D. Stussy wrote:

    > (.*)-(.*)-(.*)-(.*)
    >
    > I don't recall offhand how to collapse that further for the 3 repetitions of
    > "-(.*)" but the above should work.


    Thanks

    Dan

  4. Re: Regular Expression

    On Mon, 07 Apr 2008 21:17:09 -0700, D. Stussy wrote:

    > (.*)-(.*)-(.*)-(.*)
    >
    > I don't recall offhand how to collapse that further for the 3 repetitions of
    > "-(.*)" but the above should work.


    Thanks

    Dan

  5. Re: Regular Expression

    Dan N writes:

    >Sorry, this may not be the best newsgroup, but it is the most Linux savvy
    >of any I know.


    >I'm trying to figure out a regular expression to match a line with more
    >than 2 '-' characters in it. Is this possible?


    /.*-.*-.*-/

    This is hardly a networking question.



    >Dan


  6. Re: Regular Expression

    >>>>> "Unruh" == Unruh writes:

    >> I'm trying to figure out a regular expression to match a line
    >> with more than 2 '-' characters in it. Is this possible?


    Unruh> /.*-.*-.*-/

    Unruh> This is hardly a networking question.

    It looks like a homework question.



    --
    Lee Sau Dan u ~{@nJX6X~}

    E-mail: danlee@informatik.uni-freiburg.de
    Home page: http://www.informatik.uni-freiburg.de/~danlee

  7. Re: Regular Expression

    Dan N wrote:
    > Sorry, this may not be the best newsgroup, but it is the most Linux savvy
    > of any I know.
    >
    > I'm trying to figure out a regular expression to match a line with more
    > than 2 '-' characters in it. Is this possible?
    >
    > Dan


    Instead of using constructions to match for multiple occurrences of a
    character, you should try matching for that character in a line and use
    the designated regexp function to return a result count.

    But since this is very very basic regexp material, I suggest you read up
    on regular expressions (google) before asking stuff on (the wrong)
    newsgroups.

    -R-

+ Reply to Thread