Find lines with more than N characters

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

Find lines with more than N characters

Postby javiergp » Tue Apr 12, 2005 10:59 am

Hi!
Is possible that Ultraedit found in different files (opened) the lines with more than N characters (for example 132)?
If yes, how can i do it?
User avatar
javiergp
Newbie
 
Posts: 5
Joined: Wed Mar 30, 2005 12:00 am

Re: Find lines with more than N characters

Postby ASTTMan » Wed Apr 13, 2005 9:04 am

As far as I can tell, UE doesn't support the {min,max} RE format, so there is no easy way to do this. You could, of course, do a find with RE "^...<133 dots>....+", but that's a pain. (It would really have to be 133 dots in a row!)

You could do it in a macro with something like this:

InsertMode
ColumnModeOff
HexOff
UnixReOff
top
Loop
Key RIGHT ARROW
Key END
IfColNumGt 132
ExitLoop
EndIf
IfEof
ExitLoop
EndIf
EndLoop

(Note that this assumes you don't have the option checked to allow positioning beyond line end.)

This would find the first line with more than 132 characters in it in the current file. You could then wrap it in a macro to try all open files. But this isn't very elegant either.

Maybe someone else has an idea.

Dave
User avatar
ASTTMan
Basic User
Basic User
 
Posts: 26
Joined: Fri Feb 18, 2005 12:00 am
Location: Arlington, TX

Re: Find lines with more than N characters

Postby Mofi » Sat Jul 29, 2006 2:56 pm

This can be done with a regular expression Find In Files search.

In UltraEdit style just enter a % (= start of line) followed by 132 ? (= single character except newline).

With Perl regular expression a more elegant method is available: ^.{132,}. I have not tested this regex!
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4055
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions