Find and delete lines NOT from a range of ASCII values

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

Find and delete lines NOT from a range of ASCII values

Postby ryan8888 » Wed May 21, 2008 2:32 am

Hi, I have a text file with many lines of text. I would like to find and delete lines that contains ascii other than those from Hex 20 to Hex 7A.

Example:
׳”׳•׳¨׳“׳” dragonbol
zx naissan 300 turbo

Line 1 is to be deleted but not line 2.

Please help. Thank you.
ryan8888
Newbie
 
Posts: 1
Joined: Wed May 21, 2008 2:25 am

Re: Find and delete lines NOT from a range of ASCII values

Postby Mofi » Wed May 21, 2008 2:52 am

Following Perl regular expression worked with UE v14.00b.

Find What: ^.*[^\x20-\x7a\r\n\t].*\r*\n
Replace With: nothing

^ ... start of line
.* ... any character 0 or more times except new line chars
[^\x20-\x7a\r\n\t] ... a single character not hex 20 to 7A and not a CR, LF or tab
.* ... any character 0 or more times except new line chars
\r* ... carriage return (CR) 0 or more times
\n ... line feed (LF)
User avatar
Mofi
Grand Master
Grand Master
 
Posts: 4064
Joined: Thu Jul 29, 2004 11:00 pm
Location: Vienna


Return to Find/Replace/Regular Expressions