How do I replace all numbers [0-9] with something else?

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, MudGuard

Post Reply
joeytogo
Posts: 10
Joined: Thu Oct 14, 2010 2:43 am
Location: US

How do I replace all numbers [0-9] with something else?

Post by joeytogo »

How do I replace all numbers [0-9] with something else? I was trying [0-9].
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Did you select Regular expression?

The regular expression [0-9] matches any single digit.
The regular expression [0-9]+ matches any non-empty sequence of digits.
joeytogo
Posts: 10
Joined: Thu Oct 14, 2010 2:43 am
Location: US

Thanks Ben, You are the Text Pad Master!

Post by joeytogo »

Thanks Ben, You are the Text Pad Master!
joeytogo
Posts: 10
Joined: Thu Oct 14, 2010 2:43 am
Location: US

Hi Ben, I want to replace [0-9] with [0-9], (ie: 1 with 1,)

Post by joeytogo »

Hi Ben, I want to replace [0-9] with [0-9], (ie: 1 with 1,)
this does not work

reg. ex. on
find
[0-9]
replace with
[0-9],

This gives [0-9], rather than the #,.

Can you help?
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

A replacement expression is not a regular expression.

Use
Find what: ([0-9])
Replace with: \1,
or
Find what: [0-9]
Replace with: \0,
The first of these assumes you are using "Posix" regular expression syntax:
Configure | Preferences | Editor

[X] Use POSIX regular expression syntax
Post Reply