Visible Characters, Except for Comma and Quote

General questions about using TextPad

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

Post Reply
User avatar
kengrubb
Posts: 324
Joined: Thu Dec 11, 2003 5:23 pm
Location: Olympia, WA, USA

Visible Characters, Except for Comma and Quote

Post by kengrubb »

I wanted to do a search and replace of all visible characters (Space thru Tilde), except for Comma and Quote, and replace it with a lowercase x.

I tried to use this, but I missed some things.

[x20-x21x23-x2Bx2D-x7E]

Then I tried this, which also missed some things.

([x20-x21]|[x23-x2B]|[x2D-x7E])

Should I really be using this, which also excludes x?

([x20-x21]|[x23-x77]|[x79-x2B]|[x2D-x7E])
(2[Bb]|[^2].|.[^Bb])

That is the question.
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

for the hex characters, the \ is missing - it should be \x20-\x21 and so on
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Or you can enter the characters directly:
[ !#-+\--~]

Or you can separate the range from the exclusions by using negative look-ahead:
(?![,"])[ -~]
or positive look-ahead:
(?=[ -~])[^,"]

But do you really need to restrict this to the range space to tilde? If not, you can simply use
[^,"\n]
This way you have to explicitly exclude newline.
Post Reply