Adding a prefix?

General questions about using TextPad

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

Post Reply
terrypin
Posts: 174
Joined: Wed Jul 11, 2007 7:50 am

Adding a prefix?

Post by terrypin »

I suspect I've forgotten some basic option...

How would I get data like this

1: Tuesday 2nd July, 2019
2: Wednesday 3rd July, 2019
3: Thursday 4th July, 2019
.
.
11: Friday 12th July, 2019
12: Saturday 13th July, 2019



converted to this please?

Day 1: Tuesday 2nd July, 2019
Day 2: Wednesday 3rd July, 2019
Day 3: Thursday 4th July, 2019
.
.
Day 11: Friday 12th July, 2019
Day 12: Saturday 13th July, 2019

If it matters, the Day number would never exceed 99.

Terry, East Grinstead, UK
User avatar
MudGuard
Posts: 1295
Joined: Sun Mar 02, 2003 10:15 pm
Location: Munich, Germany
Contact:

Post by MudGuard »

are there lines in the file that don't need the prefix?

If not, search for

Code: Select all

^
and replace with

Code: Select all

Day_
Otherwise, search for

Code: Select all

^\d+:_(?:Mon|Tues|Wednes|Thurs|Satur|Sun)day
and replace with

Code: Select all

Day:_$0
(_ should be a space)
terrypin
Posts: 174
Joined: Wed Jul 11, 2007 7:50 am

Post by terrypin »

Many thanks, that works a treat!

I hadn't realised that ^ could be used in that solo fashion.

Terry, East Grinstead, UK
Post Reply