results:
<input id="file_upload" type="file"/> ass ->
works satisfactorily.
but if I want to implement conditional (?) / {0,1} occurrences for <begin> or <end>:
1) '(?P<begin><!-+)?(?P<between>.*?)(?P<end>-+>)?'
2) '(<!-+)?(?P<between>.*?)(-+>)?'
the result looks GREEDY/or replaced in all occurences.. count=x flag wont help - disables replacements at all.
other pattern tryings with similar result is failing too:
3) '(<!-+){0,1}(?P<between>.*?)(-+>){0,1}' replacement = r'\g<between>'
4) '(<!-+)?(?:.*?)(-+>)?' replacement = ''
5) '(?:<!-+)?(.*?)(?:-+>)?' replacement = '\\1'
all results are:
<input id="file_upload" type="file"/> ass
(last '->' should stood). any clue?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
missing explanation: function of this script was to fast process single line without selection. To check validity of html comments in multiline, I am going to do another thing..
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
+ fast comments/uncomments single line without selection
+ allows conditional instances of '<!-' and '->' in NON-GREEDY way
+ shortens '<!------' and '------->' cases
+ correctly handles reversed setting of comments "-> . . . <!-" and recognizes "<!- . . <!- . . ->" situations
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Problem looks easy. I havent issue like this in other languages, I cant find reason. PythonScript for Notepad++:
non-greedy html comment removal for entity:
<!- <input id="file_upload" type="file"/> -> ass ->
python script: (?P<begin> and ?P<end> group names are for clearness)
results:
<input id="file_upload" type="file"/> ass ->
works satisfactorily.
but if I want to implement conditional (?) / {0,1} occurrences for <begin> or <end>:
1) '(?P<begin><!-+)?(?P<between>.*?)(?P<end>-+>)?'
2) '(<!-+)?(?P<between>.*?)(-+>)?'
the result looks GREEDY/or replaced in all occurences.. count=x flag wont help - disables replacements at all.
other pattern tryings with similar result is failing too:
3) '(<!-+){0,1}(?P<between>.*?)(-+>){0,1}' replacement = r'\g<between>'
4) '(<!-+)?(?:.*?)(-+>)?' replacement = ''
5) '(?:<!-+)?(.*?)(?:-+>)?' replacement = '\\1'
all results are:
<input id="file_upload" type="file"/> ass
(last '->' should stood). any clue?
easy way: importing string and using 3 commands /I really wanted to avoid that way:
result:
+ allows conditional instances of '<!-' and '->' in NON-GREEDY way
+ shortens '<!------' and '------->' cases
- unfortunately allows removal reversed setting of comments "-> . . . <!-"
but of course Ive created a magic pattern to do this all, and I challenge anyone to shorten it
missing explanation: function of this script was to fast process single line without selection. To check validity of html comments in multiline, I am going to do another thing..
one more correction:
+ now it also poperly handles "-> . . . <!-" and "<!- . . <!- . . ->" cases, it will be well self-explanatory during exploitation
there rly should be edit option. there was little error in code. here is full and tested html comment script for Notepad++:
+ fast comments/uncomments single line without selection
+ allows conditional instances of '<!-' and '->' in NON-GREEDY way
+ shortens '<!------' and '------->' cases
+ correctly handles reversed setting of comments "-> . . . <!-" and recognizes "<!- . . <!- . . ->" situations
forgot about printing (add this to the bottom of script):
here is full, expanded code
https://sourceforge.net/projects/npppythonscript/forums/forum/1199074/topic/4559654/index/page/1
http://snipplr.com/view/55184/toggle-html-comment-pythonscript-for-notepad/