[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Regex Question



Telly Williams wrote:
Hi,

	I'm reading up on Regular Expressions and I have a question about alternation.

	I have the sentences: "There was a dog in the house." & "A house on the hill."

	Both of these are in a file (named "regex") on two different lines.

	My understanding of alternation is that it will look both for what is on the right and left of the pipe.

So, if I type:
		grep in|hill regex

	isn't that supposed to give me both sentences in stdout?

	When I type that, I get nothing at all on return.  I've even typed it as:

		grep in\|hill regex

	and I still get nothing.  What am I doing wrong?  Is what I'm typing and what I'm asking for two different things?  Thanks.


I think egrep handles regular expressions, while grep just does the simple string matching.

Hope this helps!
Steve



Reply to: