hi all, I need to manipulate files looking for and modifying some tags, transforming capital letters where present into lowercase. For the search I used regular expressions. This regular expression works perfectly in the npp ++ search and replace command but does not work in a python script. The command in question is: editor.rereplace ("((\ /) *) ([a-zA-Z] +) ((\ d) +) "," $ 1 (\ L $ 3) $ 4 "). Suggestions? thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hello, but the command editor.rereplace () unlike editor.replace () is not already addressed for the regex engine? if not what is the difference? thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Taking the addition of "r" for granted so that my backslashes are processed by the regex engine, the problem of uppercase to lowercase characters with "\ L" remains. I doubt the correct syntax to bring everything in lowercase associated with group # 3:
(\L$3)
Is this correct?
Thanks
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
hi all, I need to manipulate files looking for and modifying some tags, transforming capital letters where present into lowercase. For the search I used regular expressions. This regular expression works perfectly in the npp ++ search and replace command but does not work in a python script. The command in question is: editor.rereplace ("((\ /) *) ([a-zA-Z] +) ((\ d) +) "," $ 1 (\ L $ 3) $ 4 "). Suggestions? thanks
Probably you need to use "raw strings" so that your backslashes aren't consumed by Python's interpretation and not given to the regex engine.
So, instead of:
do:
editor.rereplace(r"abc", r"def")
hello, but the command editor.rereplace () unlike editor.replace () is not already addressed for the regex engine? if not what is the difference? thanks
Taking the addition of "r" for granted so that my backslashes are processed by the regex engine, the problem of uppercase to lowercase characters with "\ L" remains. I doubt the correct syntax to bring everything in lowercase associated with group # 3:
Is this correct?
Thanks
It appears there may be a problem with the special casing stuff in Pythonscript...see https://github.com/bruderstein/PythonScript/issues/199
hello, yes that's my post :-)
Last edit: claudio C. 2021-05-21