* Search and Replace 3.2

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
ronk
Superstar
Posts: 428
Joined: 19 Feb 2016 22:50
Family Historian: V7
Location: MN, USA
Contact:

Search and Replace 3.2

Post by ronk » 30 Dec 2020 22:47

Somewhere I read that using LUA patterns for searching allows or is like using regular expressions. In notepad this expression: ^.*\b(mPR|dPR|bPR)\b.*$ obtains correct results, but in the Search and Replace plugin, with the LUA Pattern Mode ticked,Search Only finds nothing. What would be the equivalent in LUA pattern? The desired text strings are mPR, dPR, or bPR, case insensitive.

Ron
Ron Krzmarzick~~ FH 7.0.20 TNG 14.0.2 website Roots & Relatives Remembered, Laragon 5.0, Win 11 pro

User avatar
tatewise
Megastar
Posts: 27079
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Search and Replace 3.2

Post by tatewise » 30 Dec 2020 23:50

They are like regular expressions but are NOT regular expressions as explained in Lua Patterns in the Help & Advice pages.

To search for that pattern of three case insensitive letters use [mdbMDB][pP][rR]

The nearest to \b backspace would have to be %c any control character.
( I'm not sure where you would have backspace in any FH Project data. )
Although, somewhere I have read that \b means match whole words, which would be more difficult in Lua Patterns.

So the whole pattern might be ^.*%c([mdbMDB][pP][rR])%c.*$

What exactly are you searching for and what do you want to replace it with?

I presume you want to replace, otherwise why have the capture brackets ( ) or maybe they are not capture brackets?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ronk
Superstar
Posts: 428
Joined: 19 Feb 2016 22:50
Family Historian: V7
Location: MN, USA
Contact:

Re: Search and Replace 3.2

Post by ronk » 31 Dec 2020 00:26

Mike,

That didn't work for me, per the snapshot. No results. I am looking for the 3 text strings, 3 letters together each. Is that what the pattern is looking for? Those are actually present in those groups of characters.

The backspaces aren't needed.
searchreplace.jpg
searchreplace.jpg (33.66 KiB) Viewed 1344 times
Ron Krzmarzick~~ FH 7.0.20 TNG 14.0.2 website Roots & Relatives Remembered, Laragon 5.0, Win 11 pro

User avatar
tatewise
Megastar
Posts: 27079
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Search and Replace 3.2

Post by tatewise » 31 Dec 2020 00:40

If you want to search for the 3 text strings, 3 letters together, then use [mdbMDB][pP][rR]
That is searching for:
1st character is any one of mdbMDB
2nd character is either of pP
3rd character is either of rR

But with that simple pattern, they may occur within another word.

The ^.* and .*$ are superflous.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
ronk
Superstar
Posts: 428
Joined: 19 Feb 2016 22:50
Family Historian: V7
Location: MN, USA
Contact:

Re: Search and Replace 3.2

Post by ronk » 31 Dec 2020 00:52

Thanks Mike,

That worked, with of course a few unintended findings as you suggested might occur. I will review the LUA patterns since different than regular expressions. There were superfluous characters because I had mimicked something I found on a regex site.

Isn't it nearly 1am in the UK? Do you sleep?
Ron Krzmarzick~~ FH 7.0.20 TNG 14.0.2 website Roots & Relatives Remembered, Laragon 5.0, Win 11 pro

User avatar
tatewise
Megastar
Posts: 27079
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Search and Replace 3.2

Post by tatewise » 31 Dec 2020 01:00

I am a bit of a night owl :lol:
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply