Regex bug: Starts w/ '^' but finding stuff NOT at start

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
jeffy
Posts: 323
Joined: Mon Mar 03, 2003 9:04 am
Location: Philadelphia

Regex bug: Starts w/ '^' but finding stuff NOT at start

Post by jeffy »

I have this NON-WORKING Java code.

Code: Select all

__TAB__public GLTRawIsListOfE(boolean b_elementsCopyable, String s_rgcName)  {
	/**
		<P>Create a new <CODE>GLTLOCharSequenceRoot</CODE>.</P>
		
		YYY
It's a constructor's signature line (nothing after the opening curly), and the top of the next function's JavaDoc (documentation) block. (I use signature lines from other classes for constructing functions sometimes.)

When searching for

Code: Select all

^[ \t]*(?:public|protected|private)?\s+\b\w+\b\s*\(
It should find

Code: Select all

__TAB__public GLTRawIsListOfE(
And it does. However, when searching in the up direction only, it also BUT ONLY SOMETIMES finds

Code: Select all

boolean b_elementsCopyable, String s_rgcName)  {
	/**
		<P>Create a new <CODE>GLTLOCharSequenceRoot</CODE>.</P>
		
Huh? The regex is anchored to line-start, so something is clearly wrong here. In anyone else seeing this?
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Yes, I am. And I can't see any rhyme or reason in when it happens.
User avatar
jeffy
Posts: 323
Joined: Mon Mar 03, 2003 9:04 am
Location: Philadelphia

Post by jeffy »

Good. Thanks ben_josephs. I reported it.
Post Reply