simple regex question

From: Christopher L. Barnard (cbar44@tsg.cbot.com)
Date: Fri Jan 28 2005 - 19:54:14 EST


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



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:30:05 EDT