I am going through my media and source name to rationalise them.
I have a several hundred of each in the format:
Census England Berwick On Tweed 1851 - HO107 piece 2421 folio 502 page 14
and I wish it to become
Census 1851 England Berwick On Tweed - HO107 piece 2421 folio 502 page 14
i.e. just move the year.
What should the pattern be please? I just can't get my head around these yet.
TIA
John
* Help with Lua Pattern for search and replace plugin
- johnmorrisoniom
- Megastar
- Posts: 904
- Joined: 18 Dec 2008 07:40
- Family Historian: V7
- Location: Isle of Man
- tatewise
- Megastar
- Posts: 28410
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Help with Lua Pattern for search and replace plugin
Search: ^Census (.- )(%d%d%d%d )(%- .+)$
Replace: Census %2%1%3
That search should do it where :-
^Census is start of text anchor and match for Census
(.- ) captures the shortest text after Census up to a space and 4 digits
(%d%d%d%d ) captures 4 digits and a space
(%- .+) captures a non-magic hyphen, a space, and the remaining text
$ is end of text anchor
To get it to work reliably notice how each component except the last ends with a space character.
The replace is :-
Census followed by the 2nd, 1st, and 3rd captures.
Replace: Census %2%1%3
That search should do it where :-
^Census is start of text anchor and match for Census
(.- ) captures the shortest text after Census up to a space and 4 digits
(%d%d%d%d ) captures 4 digits and a space
(%- .+) captures a non-magic hyphen, a space, and the remaining text
$ is end of text anchor
To get it to work reliably notice how each component except the last ends with a space character.
The replace is :-
Census followed by the 2nd, 1st, and 3rd captures.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- johnmorrisoniom
- Megastar
- Posts: 904
- Joined: 18 Dec 2008 07:40
- Family Historian: V7
- Location: Isle of Man
Re: Help with Lua Pattern for search and replace plugin
Brilliant Mike, Thanks very much.
Over 2000 replacements done in about 2 minutes.
I'll get the hang of lua patterns one day.
John
Over 2000 replacements done in about 2 minutes.
I'll get the hang of lua patterns one day.
John