Re: Simple regular expression not doing what I think it should
- --- In firstname.lastname@example.org, "Sheri" <silvermoonwoman@...> wrote:
> --- In email@example.com, "Sheri" <silvermoonwoman@> wrote:
> > --- In firstname.lastname@example.org, "mycroft_b" <mycroft_b@> wrote:
> > > I thought the caret (^) matches at the beginning of a line so I
> > > thought the reg expression ^\^ would only match a caret at the
> > > beginning of a line.
> > >
> > > Why does it match ALL carets (one at a time) in the following
> > > text? What should my expression be?
> The regex engine used by NoteTab, PCRE, can match at the beginning
> the subject text as well as at the beginning of internal lines. Whena
> you Find one match at a time, after a hit, the beginning of a NEW
> subject is at the next character. Usually that is fine, because the
> next character doesn't match the rest of the pattern.
> Maybe what you want to do is match not only the starting caret in
> column one in your text, but the rest of the line as well:
> Then on the next execution, it won't be anchored at the start of a
> possible unwanted match.
> NoteTab Pro has done something to defeat the matching behavior when
> pattern begins with a caret. It moves the cursor to the beginning ofespecially
> the next line before using PCRE. That causes problems too,
> if you are trying to search in highlighted text and don't want theLight
> cursor moved when there is no match. So I prefer the way NoteTab
> and Standard work (although you can get around the NoteTab Pro "fix"pattern.)
> by putting a (?#comment) in front of the leading caret in the
>Wow. Figures a relative beginner would bump into something like that.
> In other operations, like replacing all occurrences, NoteTab treats
> the whole document as the subject. I believe it is only when using
> Find that there's an issue.
Thanks for the replies. (?<=\r\n)\^ works the best because I am doing
more than what you know... I simplified my question and ^\^.* matches
the entire line which I didn't want (but you didn't know). It's a
good little example of lookbehind assertions which I have never used.
So it seems to me it really WASN'T working according to the
documentation for whatever reason. Regular expressions are an
amazingly powerful search feature and I'm new to it to.
Thanks for the help.