How to Search for...

General questions about using TextPad

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

Post Reply
bvy
Posts: 7
Joined: Thu Oct 09, 2003 12:57 pm

How to Search for...

Post by bvy »

Hi. Is there any way to search a document for any instances of an ASCII character value greater than or equal to 128? I want to find and whack all the ç's and ©'s, etc., without having to search them out individually. Thanks.
User avatar
Tomas Eklund
Posts: 40
Joined: Tue Mar 16, 2004 1:15 am
Location: Sweden

Post by Tomas Eklund »

Okay, now I'm confused... This should work:
Search for: [\x80-\xFF]
Replace with: (nothing)

[X] Regular expression
But it doesn't. However, this works (though it really shouldn't!):
Search for: [^\x80-\xFF]
Replace with: (nothing)

[X] Regular expression
This third solution is however (edit:) obviously not correct but it seemed to work:
Search for: [^\x00-\x7F]
Replace with: (nothing)

[X] Regular expression
Must be some kind of bug (or I'm just stupid and missing something). Oh, and I tried this in Textpad 5.0, not in 4.x.
Last edited by Tomas Eklund on Tue Mar 06, 2007 10:05 am, edited 1 time in total.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

That's because backslash isn't a special character in a character class and a hexadecimal representation of a character isn't interpreted as such in a character class. For example, the regex [\x80] matches any of the individual characters: \ x 8 0. So [\x80-\xFF] is equivalent (by reordering and removing duplicates) to [8Fx0-\], which is equivalent to [0-9:;<=>?@A-Zx[\], which matches most characters whose ASCII value is less than 128 (particularly when the search is case-insensitive).

Try [€-ÿ] .
User avatar
Tomas Eklund
Posts: 40
Joined: Tue Mar 16, 2004 1:15 am
Location: Sweden

Post by Tomas Eklund »

Good thing there are knowledgeable people here too, and not just chumps like me... :-/
bvy
Posts: 7
Joined: Thu Oct 09, 2003 12:57 pm

Post by bvy »

This helps. Half way there. But I would expect that searching on this

[€-ÿ]+

to select contiguous instances of those characters. If I have ââââ in a document, I would expect that to select the entire string, not each character one at a time. Searching on e+ or even [e]+, will select the entire string eeee. What am I doing wrong?
bvy
Posts: 7
Joined: Thu Oct 09, 2003 12:57 pm

Post by bvy »

It does just that. Never mind.
Post Reply