Find acts different between v10 and v12

Find, replace, find in files, replace in files, regular expressions

Find acts different between v10 and v12

Postby ConversisIan » Fri Dec 08, 2006 10:05 am

I have a macro written in 10. which is using the find command with regular expressions

find = *<

which works in 10 from wherever my cursor is up to the next "<"

however when I try this in 12, it always goes to the beginning of the next line to perform this search, not from where the cursor is positioned, is this an improvement?

i.e in a txt where my cursor is as below ( cursor signified by "|", selected text indicated by bold)

text with cursor in| followed by<
text on new line<

in 10 I get this highlight

text with cursor in followed by<
text on new line<

and in 12

text with cursor in followed by<
text on new line<

anyone know why this is or if I can get it to behave as before?
User avatar
ConversisIan
Newbie
 
Posts: 1
Joined: Fri Dec 08, 2006 12:00 am

Re: Find acts different between v10 and v12

Postby Mofi » Fri Dec 08, 2006 10:34 am

You are right. Find RegExp "*<" works different in v11.20a and v12.20a+4 too.

The reason is, that *< is a bad regular expression string. * means 0 or more occurencies of any character except new line characters. Although this is not an explanation why in v12 it now always starts the search after a line termination character, a * should be never used without a defined character before and after.

There is a simple solution which works for v10 and v12. A better regex search string. UltraEdit style!

Find RegExp "[~<^r^n]++<"

This will select everthing from current cursor position till next < in the current line only.

If you want a multi-line selection from current cursor position till next < you can use this regular expression search.

Find RegExp "[~<]++<"
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4051
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions