there must be a regex way to do this

General questions about using TextPad

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

Post Reply
lklawrie
Posts: 56
Joined: Fri Aug 22, 2003 3:19 pm
Location: Pagosa Springs, Colorado, USA
Contact:

there must be a regex way to do this

Post by lklawrie »

I am just not that expert in regular expressions.

I want to search for

City=<word>.<word>.<word>

where the number of words is unknown.

and replace the . with space.
Linda
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Do you want every dot that's immediately preceded and followed by words to be replaced by a space?

If so, try
Find what: (\w)\.(\w)
Replace with: $1_$2 [Replace the underscore with a space]

[X] Regular expression

Replace All
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Or
Find what: \b\.\b
Replace with: _ [Replace the underscore with a space]
lklawrie
Posts: 56
Joined: Fri Aug 22, 2003 3:19 pm
Location: Pagosa Springs, Colorado, USA
Contact:

Post by lklawrie »

There are numbers in the file too. I don't want their . to be replaced. Only on the lines that start with "city="
Linda
ben_josephs
Posts: 2464
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Find what: ^(City=.*)\b\.\b
Replace with: $1_ [Replace the underscore with a space]

[X] Regular expression

Replace All -- do this repeatedly until it beeps
Post Reply