notepad++ replace regex for private Bible module

Share your favorite tips, workarounds and shortcuts for theWord
krzysztofglinka
Posts: 4
Joined: Sat Oct 03, 2020 7:28 pm

notepad++ replace regex for private Bible module

Post by krzysztofglinka »

I am working on my private Bible module in Polish.
I did full 31102 lines file :)
Plain text without any references etc

Now I want to add strong codes to words.
Started with word "Jesus"
In Polish little complex ;) language we have variation of started "Jezus" and many suffixes: Jezusa, Jezusowi, Jezusie etc

How to use "Replace" option in Notepad++ (I use most of time) to append Strong code <WG2424> after any form of Jezus* word?
Can You help me?
krzysztofglinka
Posts: 4
Joined: Sat Oct 03, 2020 7:28 pm

Re: notepad++ replace regex for private Bible module

Post by krzysztofglinka »

I found:
find: \bJezus\w*\K
replace with: <WG2424>

Jezus<WG2424>
Jezusa<WG2424>
Jezusowi<WG2424>
Jezusem<WG2424>
User avatar
jonathangkoehn
Posts: 1241
Joined: Wed Sep 29, 2010 11:04 pm
Location: Colorado, United States
Contact:

Re: notepad++ replace regex for private Bible module

Post by jonathangkoehn »

Greetings Krzystofglinka,
Please refer to Notepad++ help forum for help with their product. (It does look like you are getting there though.)
I would suggestion
Regex:
find: (\bJezus\w*\K)
replace: $1<WG2424>

Perhaps this is what you are already doing?

OOps please don't use ( ) $1 with \K my bad.
Jonathan Koehn @ https://www.thewordbooks.com
TotheWord make resources for theWord
2 Timothy 2:15 “Make every effort to present yourself before God as a proven worker who does not need to be ashamed, teaching the message of truth accurately.” NET2
User avatar
JG
Posts: 4589
Joined: Wed Jun 04, 2008 8:34 pm

Re: notepad++ replace regex for private Bible module

Post by JG »

With the \K there is no need to have any back refs, the match up to that point does not get replaced.

However something like
\bJezus\w*\b\K(?!<W[HG])
should stop accidentally putting duplicate tags
Jon
the
Word 6 Bible Software
OS for testing; Windows 10
Beta Download ------Beta Setup Guide------On-line Manual------Tech doc's and Utilities------Copyright Factsheet
smiths89
Posts: 8
Joined: Wed Mar 15, 2023 9:52 am

Re: notepad++ replace regex for private Bible module

Post by smiths89 »

Absolutely, here's a simpler set of instructions:

Open "Replace" with Ctrl + H.
Type \bJezus(?:a|owi|ie|em|u)?\b in "Find what."
Put Jezus<WG2424> in "Replace with."
Check "Regular expression."
Click "Replace All."
This will tag <WG2424> after "Jezus" and its common suffixes. Test on a small part to be sure.
octopustrice
Posts: 1
Joined: Thu Jan 11, 2024 7:44 pm

Re: notepad++ replace regex for private Bible module

Post by octopustrice »

Certainly, you can use regular expressions in Notepad++ to accomplish this. Here's a step-by-step guide:
Open your document in Notepad++.
Press Ctrl + H to open the "Replace" dialog.
In the "Find what" field, enter the following regular expression:
(Jezus[a-zA-ZąćęłńóśźżĄĆĘŁŃÓŚŹŻ]+)
This regular expression captures the base form "Jezus" followed by any Polish letters that might appear in the suffix.
In the "Replace with" field, enter: $1<WG2424>
The $1 represents the content captured by the parentheses in the "Find what" expression, and <WG2424> is the Strong code you want to append.
Check the "Regular expression" option in the "Search Mode" section.
Click "Replace All" to replace all instances of "Jezus" with the Strong code appended.
This regular expression should work for variations like "Jezusa," "Jezusowi," "Jezusie," and more. However, it's essential to review the changes to ensure accuracy.
elementaryrelish
Posts: 1
Joined: Mon Jan 29, 2024 6:38 pm

Re: notepad++ replace regex for private Bible module

Post by elementaryrelish »

Certainly! To use the "Replace" option in Notepad++ to append the Strong code <WG2424> after any form of "Jezus" in your text, you can follow these steps:
Open your text file in Notepad++.
Press Ctrl + H to open the "Replace" dialog.
In the "Find what" field, enter the regular expression for matching any form of "Jezus." In Polish, this might include variations like "Jezus," "Jezusa," "Jezusowi," and "Jezusie." You can use a regular expression to capture these variations.
Jezus(?:a|owi|ie)?
Jezus is the base form.
(?:a|owi|ie)? is a non-capturing group that matches the suffix variations (a, owi, ie) optionally.
In the "Replace with" field, enter the replacement pattern with the Strong code. Use $& to reference the matched text.
$&<WG2424>
$& represents the entire matched text.
Check the option for "Regular expression" at the bottom of the "Replace" dialog.
Click on "Replace All" to replace all occurrences at once, or use "Replace" to replace them one by one.
Note: Always make sure to have a backup of your file before performing mass replacements.
Post Reply