You are here: PSPad forum > English discussion forum > Re: I need a special regular expression

Re: I need a special regular expression

#1 I need a special regular expression

Posted by: PSPad | Date: 2022-03-20 00:20 | IP: IP Logged

I need a special regular expression that will change the English abbreviations for the books of Scripture to Polish abbreviations for the books of Scripture.

Example:
Gen -> Rdz
Ex -> Wj
Col -> Kol

A total of 66 books

jan1248.pl

Edited 1 time(s). Last edit at 2022-03-20 00:23 by PSPad.

Options: Reply | Quote | Up ^


#2 Re: I need a special regular expression

Posted by: vbr | Date: 2022-03-20 01:15 | IP: IP Logged

PSPad:
I need a special regular expression that will change the English abbreviations for the books of Scripture to Polish abbreviations for the books of Scripture.

Example:
Gen -> Rdz
Ex -> Wj
Col -> Kol

A total of 66 books

jan1248.pl

Hi,
a user convertor seems to be suitable for this task;
there is som einfo in the helpfile and a template file, with some examples:
...\PSPad\Convertor\Template.in_

You can try the following pattern (after completing the other abbreviations)
save the file e.g. as

...\PSPad\Convertor\BiblAbbr_Eng_Pol.ini

All occurences of the found strings will be replaced with strings replacement mode, if this is not wanted (e.g. for matches within other text), the regex mode can be used, where \b can mark the word boundary (however, currently it also matches next to accented letters etc.)

The user convertor is called from the menu Tools: User convertors... (after saving the ini file in the correct folder, the item will appear in the list of convertors.

hth,
vbr

Quote:
;User conversion definition file for PSPad editor
[Settings]

ForwardName=Bible Book Abbr English - Polish
; BackwardName=Bible Book Abbr Polish - Polish

ForwardIgnoreCase=0
BackWardIgnoreCase=0

; ConversionStyle=strings
ConversionStyle=regexpressions

;expression from|expression to
[Strings]
Gen|Rdz
Ex|Wj
Col|Kol

;regular expression|substitutions. Delimiter is the last pipe |
[RegExpressions]
\bGen\b|Rdz
\bEx\b|Wj
\bCol\b|Kol

Options: Reply | Quote | Up ^


#3 Re: I need a special regular expression

Posted by: pspad | Date: 2022-03-20 06:02 | IP: IP Logged

And there is a makro, what can call user convertor to all open files.
First call let you choose convertor, following call will use the same convertor on rest of open files.

Options: Reply | Quote | Up ^


#4 Re: I need a special regular expression

Posted by: PSPad | Date: 2022-03-20 23:43 | IP: IP Logged

It seems to convert correctly, I haven't found any error at the moment.
Thank you for your help.
Test verse:
Ge 41:41; Le 8:9; 16:23; Ps 89:4; 113:8; Isa 49:3

[RegExpressions]
\bGe\b|Rdz
\bEx\b|Wj
\bLe\b|Kpł
\bNu\b|Lb
\bDe\b|Pwt
\bJos\b|Joz
\bJg\b|Sdz
\bRu\b|Rut
\b1Sa\b|1Sm
\b2Sa\b|2Sm
\b1Ki\b|2Kl
\b2Ki\b|2Kl
\b1Ch\b|1Kn
\b2Ch\b|2Kn
\bEzr\b|Ezd
\bNe\b|Neh
\bEs\b|Est
\bJob\b|Hi
\bPs\b|Ps
\bPr\b|Prz
\bEc\b|Kzn
\bSong\b|PnP
\bIsa\b|Iz
\bJer\b|Jer
\bLa\b|Lam
\bEze\b|Eze
\bDa\b|Dn
\bHo\b|Oz
\bJoe\b|Jl
\bAm\b|Am
\bOb\b|Abd
\bJon\b|Jon
\bMic\b|Mi
\bNa\b|Nah
\bHab\b|Hab
\bZep\b|Sof
\bHag\b|Ag
\bZec\b|Za
\bMal\b|Mal
\bMt\b|Mt
\bMr\b|Mk
\bLu\b|Łk
\bJoh\b|Jn
\bAc\b|Dz
\bRo\b|Rz
\b1Co\b|1Kor
\b2Co\b|2Kor
\bGa\b|Gal
\bEph\b|Ef
\bPhp\b|Flp
\bCol\b|Kol
\b1Th\b|1Ts
\b2Th\b|2Ts
\b1Ti\b|1Tm
\b2Ti\b|2Tm
\bTit\b|Tyt
\bPhm\b|Flm
\bHeb\b|Heb
\bJas\b|Jak
\b1Pe\b|1Pt
\b2Pe\b|2Pt
\b1Jo\b|1Jn
\b2Jo\b|2Jn
\b3Jo\b|3Jn
\bJude\b|Judy
\bRe\b|Obj

Edited 3 time(s). Last edit at 2022-03-20 23:49 by PSPad.

Options: Reply | Quote | Up ^


#5 Re: I need a special regular expression

Posted by: PSPad | Date: 2022-03-21 15:24 | IP: IP Logged

Edit:

\b1Co\b|1Kor
\b2Co\b|2Kor

Correction:
\b1Co\b|1Ko
\b2Co\b|2Ko

Options: Reply | Quote | Up ^


#6 Re: I need a special regular expression

Posted by: Andreas | Date: 2022-03-30 08:56 | IP: IP Logged

Hi Jan, I think username pspad should be blocked and used only by you.

Options: Reply | Quote | Up ^






Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR