--- Jason Zeisler <[EMAIL PROTECTED]> wrote:
> I am having a disagreement with some people over regular epressions
> and I would like
> to ask the experts and see what you all have to say.
> 
> I have a file called test that looks like the following:
> $$$$$$aaaaaa
> bcdef$
> $
> abc
> 
> 
> If I use grep to search this file with the regular expression
> '^[^\$]*$' my output is just 'abc'.
> I will except the fact that I am wrong, but if I run this and I get
> the answer abc then I
> typed in something wrong or I am right. If someone could break this
> down and explain all
> details to this that would be cool. The part that is throwing us off
> is the []* part. I thought
> that it would accept anything that is not a '\' or '$' and repeat
> anything but those. The other
>  party saying that the brackets represent just on character and will
> only repeat that one
> character. 

Ok lets break it down :)
 the first "^" means the beginning of the line ya.
 next the last "$" means the end of the line. 
 So in a way your saying the entire line.
 
 now for the tricky part
  "[^\$]" is a class you defined as a single char
     that is not a "\" or "$" 
  and "*" asterisk means the preceding will match zero or more times
  
 I think whats tripping you up is that your trying to match the entire line.
 So if the line contains a \ or $ no match else match.
 You get different results by omitting the 1st ^ and last $.

RegEx's are fun!  This help?

=====
Ted Katseres
----------------
------------------------
--------------------------------


                
__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - Send 10MB messages!
http://promotions.yahoo.com/new_mail 

Reply via email to