Quote:
Originally Posted by user_none
It doesn't match from your cursor location. It matches from the beginning of the text. So since (?s)Stoker.*?Release matches from line 9 to 31 that is the only match.
The .*Release also has the same issue because it starts matching a the beginning of the line so if your cursor is at the start of class then you're already past the start point for the match.
So what this really comes down to is how to determine what a match is. I'm looking at the entire document beginning to end right now. Would it be better to do a forward and then backward search from the cursor position?
The reason I went with a beginning to end search is you will always get the same count no matter where you are in the document. Going by cursor position (as shown with this example) you will get different matching results depending on where your cursor is due to the nature of regex's including or not including text.
|
I think we're talking about 2 different things. One is Count (ie count all items on the current page). For this it seems reasonable to include the entire document regardless of where your cursor is. (Same with Replace All).
The other is Find. For this it makes sense to start the Find Next from where your cursor is - even if in the middle of a line. And since you aren't using wrap-around, to search from the cursor to the end of the document. Same with Find Previous (from the cursor) and Replace Next/Previous.
Clearly you do search from the cursor sometimes - if I just have a line like "Say hello and hello and hello again" and you do a search for just "hello" then you will find the first one, and a Find next will find the next one, etc. But a search for ".*hello" won't match anything if your cursor is not at the start of the line. So maybe the ".*" is just a special case. It wasn't anything I needed to use, just a test.
If its just a choice about different approaches then I think the others who use Sigil more need to comment. But it does look odd to me when it looks like it should match, but doesn't.