simple regex question

From: Christopher L. Barnard (cbar44_at_tsg.cbot.com)
Date: 01/29/05

  • Next message: chanchal_at_gsh-sa.com: "(no subject)"
    Date: Fri, 28 Jan 2005 18:54:14 -0600 (CST)
    To: sunmanagers@sunmanagers.org
    
    

    I want to match, case does not matter, a string
    foo: bar
    where foo starts the line, there can be one or more whitespace characters
    between the : and the bar, and there can be zero or more whitespace
    characters between the bar and the end of line. "whitespace characters"
    here means spaces or tabs.

    /usr/bin/egrep -i ^foo:[ ][ ]*bar[ ]*$

    works with any combination of spaces I use. But when I add \t to the regex:

    /usr/bin/egrep -i ^foo:[ \t][ \t]*bar[ \t]*&

    it fails. I have tried escaping the \t (as in, \\t), but that did not help.
    I tried bracketing with ( and ), but that did not help. I have used double
    and single quotes, and that did not help. Can anyone suggest how to write an
    RE that will see a tab character? TIA and I will summarize.

    +-----------------------------------------------------------------------+
    | Christopher L. Barnard O When I was a boy I was told that |
    | cbarnard@tsg.cbot.com / \ anybody could become president. |
    | (312) 347-4901 O---O Now I'm beginning to believe it. |
    | http://www.cs.uchicago.edu/~cbarnard --Clarence Darrow |
    +----------PGP public key available via finger or PGP keyserver---------+
    _______________________________________________
    sunmanagers mailing list
    sunmanagers@sunmanagers.org
    http://www.sunmanagers.org/mailman/listinfo/sunmanagers


  • Next message: chanchal_at_gsh-sa.com: "(no subject)"