On Mon, 15 Jan 2007, wrote: > On 1/15/07, Mike Miller <mbmiller at taxa.epi.umn.edu> wrote: >> 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. > > You are right, I cant get it to match either. Though, I think it > should. (Ive never *needed* to match that before) If you are trying > to match end-of-line followed by beginning-of-line, that should be a > perfectly valid sequence when you have a few blank lines in there, as > per your example. So how would one go about matching that? In a more > "rational" case, you should be able to something like this: > > $_ = "foo\n\n\nbar"; > if(/^$^$/ms) { print "it has 2 blank lines in a row\n"; } > > But that dosnt seem to match either. Now you have me wondering... Of course, the good thing about this is that you didn't want it to match! The idea was to find a string that matched nothing. So far, so good. ;-) Also, "$^" is way better than "(?!)" because "$^" is presumably always very fast. Mike