On Mon, 15 Jan 2007,   wrote:

> On 1/15/07, Mike Miller <mbmiller at taxa.epi.umn.edu> wrote:
>> On Mon, 15 Jan 2007,   wrote:
>> 
>> > On 1/12/07, Dan Drake <dan at dandrake.org> wrote:
>> >
>> >> I'm looking for a regular expression that's guaranteed to never match
>> >> anything.
>> >
>> > Ive used $^ before.  But it does depend on how you are using it.  the
>> > end-of-string followed by a beginning-of-string can show up if $ and ^
>> > match new-lines.
>> 
>> 
>> I don't understand how that can fail.  How can $ and ^ match newlines?
>> Is that something that can be affected by command line arguments?  When I
>> tried it, it seemed to work very well, so I like your idea.  It does not
>> match anything in a string of consecutive newlines, for example.
>
>
> Im not a big python person, but in perl if you add the m modifier for 
> "multiple lines" it changes the definition of ^ and $ to match newlines. 
> I assumed python would have something like it.  As long as they keep 
> their standard definitions, though, you should never find the end of a 
> string before the beginning.


I had forgotten that this was about a python regexp.  Still, I mostly use 
perl and I am interested personally in understanding this better.  I can't 
get it to mess up.  For example:

# echo 'abcd efgh' | gawk '{print $1"\n\n"$2}' | perl -pe 's/$^/X/ms'
abcd

efgh

What am I doing wrong?  I can't figure out how to get "$^" to match 
anything.

Mike