Page 1 of 1
Help with regexp
Posted: Wed Sep 18, 2024 4:50 pm
by loulou2522
I want to extract this sentence
Annulation dette frs 74 432
(8} Détail des produits et charges sur exercices antérieurs : Charges antérieures Pxet+dice N Produis antnieus
Annulation dette frs 74 432
* Des explications concemant cette rubrique sont données dans la notice n° 2032.
Can someone help me ?
Re: Help with regexp
Posted: Wed Sep 18, 2024 5:29 pm
by jacdelad
Exactly THIS sentence? Use FindString.
This senctence with variable numbers:
Exactly a pair of 2 and 3 numbers:
Code: Select all
Annulation dette frs (\d{2}) (\d{3})
Want to extract the numbers:
Gimme some more info!
Re: Help with regexp
Posted: Wed Sep 18, 2024 5:33 pm
by loulou2522
I can't because
Annulation dette frs 74 432
is not always the same text
Re: Help with regexp
Posted: Wed Sep 18, 2024 5:35 pm
by jacdelad
Ok, so: 3 words and 2 numbers?
Re: Help with regexp
Posted: Wed Sep 18, 2024 7:35 pm
by boddhi
loulou2522 wrote:
I can't because is not always the same text
Be more precise in jour request, please...
[French mode on]
Sois plus précis dans ta demande, STP.
Donne plus d'exemples de chaînes que tu es amené à traiter et ce que tu veux récupérer précisément de manière à pourvoir établir une RegEx exacte.
L'exemple sur 3 lignes que tu as donné est-il une chaîne unique avec des retours de fin de lignes ou est-ce des chaînes récupérées les unes après les autres ?
[French mode off]
[Google translate mode on]
Give more examples of the strings you have to process and what exactly you want to retrieve so that you can establish an exact RegEx.
Is the 3-line example you gave a single string with end-of-line returns, or are strings retrieved one after the other?
[Google translate mode off]
Re: Help with regexp
Posted: Wed Sep 18, 2024 9:09 pm
by Marc56us
I assume the constant is frs and a number that uses space as the thousands separator ?
Now all you have to do is add the text you want at the beginning.
Another solution is to use the string functions and read the string backwards, stopping at the first character that is neither a number nor a space.
