+1 vote
883 vues

Je souhaite changer les minuscules en majuscules dans certaines situations - par exemple, je veux changer toutes les minuscules suivant un deux-points en majuscules. Il n'existe pas de règle unique que je puisse utiliser dans RegEx Pal pour accomplir cela, mais il existe une fonctionnalité non documentée qui me permet de créer une liste de modifications simples à exécuter. (NOTE : il existe des expressions régulières qui peuvent le faire, mais pas dans RegEx Pal.)

  • Créez un document texte avec des entrées qui suivent ce format :
# I can use the # to add comments to the list
: a-->: A
: b-->: B
: c-->: C

Ce qui se trouve à gauche est séparé de ce qui se trouve à droite par -->

  • Une fois que vous avez enregistré ce fichier, vous pouvez l'utiliser dans la fenêtre de recherche de RegEx Pal en tapant :
-->{Path}\{Filename}
For instance:
-->c:\My Paratext 8 Projects\zzProj\shared\changes.txt
  • Lorsque le fichier s'exécute, il mettra en surbrillance le texte trouvé dans le chapitre entier. Si vous exécutez cela dans une opération Rechercher/Remplacer, il mettra en surbrillance le premier élément trouvé et le texte restant, mais dans le panneau de remplacement, il indiquera qu'il effectue des remplacements corrects. La fenêtre de remplacement doit être laissée vide, car la liste fournit le remplacement.

NOTE Mes expériences avec cela ont montré que je ne pouvais pas utiliser de caractères Unicode complexes. Si je voulais effectuer une modification comme :

Jesus-->Jesús

Je devais enregistrer le fichier texte au format ANSI, sinon le ú serait corrompu dans le texte.
Aussi
Bien que je puisse inclure des espaces à gauche du tiret double, je ne pouvais pas inclure un espace à la fin du côté droit - il serait supprimé lors du traitement. Et si je voulais rechercher à gauche un point ou un point d'interrogation, ceux-ci devaient d'abord être échappés :

\. a-->. A
\? a-->? A

Il y a probablement d'autres choses qui ne fonctionnent pas tout à fait comme prévu. Si vous souhaitez essayer cela, je suggère de commencer par une liste très simple et de l'ajouter au fur et à mesure.

Traduit automatiquement depuis English
Paratext par (9,9k points)
réaffiché | 883 vues

5 Réponses

0 votes
Meilleure réponse

Did you mean ASCII format?

par [Expert]
(16,7k points)

Did you mean ASCII format?

It probably is ASCII format, but when I’m Notepad++ I don’t have an option to convert to ASCII - I do have an option to convert to ANSI and that works for basic characters.

I find Notepad++ to be more helpful to me than RegexEx Pal for global changes. The regex expressions are more like Adobe InDesign’s GREP (with which I’m familiar), and NPP’s searches can use “.+” without going to the next line, which is very helpful in finding phenomena that happen within a verse.

Using the “Find in Files” tab of the Find dialog box, I set the “Filters” to “.sfm” and select the PT project folder. in the “Directory” dropdown. PT recognizes these changes in the Project History, too!

I don’t know how best to run a list of changes on NPP. Any suggestions would be appreciated.

I find EditPad Lite’s regex find/replace to be quite helpful and prefer it to Notepad++. To each their own!

If we’re going to give our favourite RegEx implementation then BBEdit would have to be mine!

And I have recently switched to Visual Studio Code.

0 votes

One other caution with using a list in this manner is that the list is not linear, but each item gets applied to everything. If I have a simple table like this:

c-->k
k-->q

The result will not be that all c become k and stop and all original k become q, but all c become q.
Here is an image of the result on text:

par (9,9k points)
0 votes

Interesting, I’ve never heard that. A little research and it seems that ANSI format is the proper name for what I have always known as Extended ASCII format.
You learn something new every day. :grinning:

par [Expert]
(16,7k points)
0 votes

Very interesting , thank you. several RegEx in a row sound like the ultimate challenge.

Did you try to use \unnnn or other encoding “tools” to treat real language data?

like:

elephant-->abʊrʊ

elephant-->ab\u028Ar\u028A

If this option were limited to ANSI, it would not be much help for projects in west Africa, I fear.

par (934 points)
0 votes

I found that the path name could not contain spaces. Is that still the case?

As far as the encoding, if you save the document as UTF-8 then you can use either Unicode Characters or character codes
ʼ–>’
‘\u02BC’-->’\u2019’

par (1,8k points)
réaffiché

My tests show that I can use a path name that includes spaces, as in: “C:\My Paratext 8 Projects…”.
When I try to run the change above, RegEx Pal finds the \u02bc, but returns the literal \u2019 (file saved as UTF8)

Questions connexes

0 votes
3 réponses 943 vues
[There is no Help topic for RegEx Pal, so I'll start this thread for myself or anyone else to add helpful ... History panic (post #3) Key terms for search: regular expression
wdavidhj 1,4k posée juin 5, 2019
0 votes
5 réponses 751 vues
It appears that for all projects that I have created in PT8 RegEx Pal displays text in the find and replace windows using ... What do I need to do to stop this from happening?
Kent Spielmann 1,8k posée févr. 26, 2018
0 votes
3 réponses 488 vues
I cannot seem to find the EXE for Paratext RegEx Pal for PT8. Can anybody help me? Thanks, SIL+LSS+PNG
SIL LSS PNG 411 posée mars 15, 2018
0 votes
10 réponses 2,1k vues
Is there are way to get the expressions on the User menu in RegEx Pal as a text file? The list of user ... . The latter could help us build a library of useful expressions.
wdavidhj 1,4k posée sept. 10, 2015
0 votes
8 réponses 1,4k vues
We have a user who has inserted a lot of \pn and some \nd inside of footnotes. We now know we need those to be ... the search to inside of a single footnote? Thank you, MSEAIT/LT
MSEAIT_LT 478 posée août 20, 2018
Welcome to Support Bible, where you can ask questions and receive answers from other members of the community.
I appeal to you, brothers and sisters, in the name of our Lord Jesus Christ, that all of you agree with one another in what you say and that there be no divisions among you, but that you be perfectly united in mind and thought.
1 Corinthians 1:10
3,044 questions
6,003 réponses
5,671 commentaires
2,026 utilisateurs