View Single Post
Old 03-28-2024, 02:16 PM   #67
lomkiri
Zealot
lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.lomkiri ought to be getting tired of karma fortunes by now.
 
lomkiri's Avatar
 
Posts: 136
Karma: 1000102
Join Date: Jul 2021
Device: N/A
Mmmh, I wrote the former message in the train, and it was written too quickly :-).
No need to change anything in the function, just put an entry in you json :
Code:
"au": ["ol", "[Pp]\\K{}(?=[a-z]+\\b)"]
and it will do exactly what you've asked.

Explanation :
The regex will be stuffed in the function with "au", so we'll apply :
[Pp]\Kau(?=[a-z]+\b)
Find [Pp] then forget this (start from after [Pp]) (because of \K)
Find "au", but only if there is [a-z]+\b after it (because of the positive lookahead)
So only "au" is selected, and it will be replaced by "ol"

BUT: get the new version of the function above, I''ve corrected a little bug that would have brought an exception in some cases.

Last edited by lomkiri; 03-28-2024 at 07:14 PM.
lomkiri is offline   Reply With Quote