I’m not sure if this belongs in the General or Plugin subs…
All of my Generic Sources have a trailing semi-colon at the end of the “Publisher Info” value string. (These were all imported from FTM; this appears to be an artifact of the FTM export.) This semi-colon “messes up” my formatted Footnotes, and I want to delete it. The Search and Replace plugin can uniquely explore this one field (so cool!), but I can’t figure out how to select this “last character” for replacement.
I tried ;\r and some other end-of-line and carriage-return expressions, and combinations of “Show White Space” but can’t select these.
I could do this to the GEDCOM in Notepad++, but “;\r” also picks other cases that I don’t want to modify, and I’d have to verify replacement one-by-one. I have hundreds.
I don’t speak “Lua” (yet). What is the expression or function or “pattern” that will let me do this with the plugin? (Re. the “LUA Pattern Mode” tick-box)
I’ve searched the KB’s -The Lua documentation may be easy to search, but it's hard for me to understand (so far; I’m just starting.).
- rob
* help with Search and Replace
- tatewise
- Megastar
- Posts: 27088
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: help with Search and Replace
Yes, you are almost there.
Firstly, assuming that there are no other semicolons you could just Search for ; and Replace with nothing.
But it is safer to use Lua Pattern Mode.
The reason \r or \n etc, won't work is that those characters are not present in the field.
They literally mean \ and r or n and to enter end-of-line you must use the Enter/Newline key.
The FHUG Knowledge Base Understanding Lua Patterns gives a better explanation than the Lua Ref Guide.
In this case, it is the Anchor magic characters that you need.
$ anchors the pattern to the end of the text.
So the Search pattern is ;$
Firstly, assuming that there are no other semicolons you could just Search for ; and Replace with nothing.
But it is safer to use Lua Pattern Mode.
The reason \r or \n etc, won't work is that those characters are not present in the field.
They literally mean \ and r or n and to enter end-of-line you must use the Enter/Newline key.
The FHUG Knowledge Base Understanding Lua Patterns gives a better explanation than the Lua Ref Guide.
In this case, it is the Anchor magic characters that you need.
$ anchors the pattern to the end of the text.
So the Search pattern is ;$
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
- Mark1834
- Megastar
- Posts: 2147
- Joined: 27 Oct 2017 19:33
- Family Historian: V7
- Location: South Cheshire, UK
Re: help with Search and Replace
To complete the explanation, carriage returns are present in the GEDCOM file, as that is plain text, but are not present in the raw data because the Publisher Info field is defined as a single line of text, so cannot contain line end or carriage return characters.
This is a perfect example of where it is appropriate to use the more sophisticated searching capability of the plugin.
This is a perfect example of where it is appropriate to use the more sophisticated searching capability of the plugin.
Mark Draper
Re: help with Search and Replace
Thank you, thank you!
"sophisticated capability" indeed.
"sophisticated capability" indeed.