• replacing complexity

    6
    0 Votes
    6 Posts
    1k Views
    Alan KilbornA

    @Matt-Whitlock said in replacing complexity:

    Is there any place you would recommend to learn more about how to use notepad++?

    I can’t offer much truly on this. Experimentation is often the best teacher. Use it!

    But the things you have asked about in your posts aren’t really Notepad++ things, they are “regular expression” data manipulation things. Regular expressions aren’t a Notepad++ concept, but rather a general concept. And I already told you to check the FAQ about learning more about that.

    For Notepad++ in general, reading this forum is a great place.
    The user manual found HERE is also good, although it, like most manuals, is a reference, not a “how to”.

  • split line help requested

    4
    1 Votes
    4 Posts
    215 Views
    Matt WhitlockM

    Thank you for the replies friends. <3

  • Select a path between words

    2
    0 Votes
    2 Posts
    166 Views
    PeterJonesP

    @ArkadiuszMichalski ,

    The three levels of single-click, double-click, and triple-click select single caret position, current word, and whole line.

    The way to get the behavior you want is to change teh definition of “word”, which you can do by setting Settings > Preferences > Delimiter > ☑ Add your characters… = :\

    I know there have been PythonScript examples of highjacking double-click as well (using the scintilla notifications and callbacks), so if you didn’t want to change the definition of “word” you could solve it another way. NppExec can do a lot, but I don’t think it can handle the notification callbacks. NppExec might be able to create a script that goes from the current position, and searches both forward and backward until it hits a space in either direction – but I usually think of NppExec as more of a batch-scripting, for interacting the entire contents of the file with external programs, and think of character-based as something better suited for PythonScript or similar, so I’m not sure how I would go about solving that problem in NppExec.

  • [Bug Report] Clickable links not completely working.

    8
    0 Votes
    8 Posts
    776 Views
    Alan KilbornA

    @Ben-Hutchinson

    I really think you should read and try to understand my earlier posting.
    Hint: I wasn’t complaining that the link wasn’t a real one.

    I think your real problem is that N++ 6.9.2 is sort of an old version.
    Suggest you try something newer, perhaps 7.9.5.

  • Regex: Copy a word/string below in a line above

    5
    1 Votes
    5 Posts
    417 Views
    Robin CruiseR

    thank you very much sir @guy038

  • Function list is coming up empty

    6
    1 Votes
    6 Posts
    602 Views
    klepp0906K

    @Michael-Vincent ok, fair enough. thats entirely acceptable to me. Now i know it is what it is, and I know how to get some color applied to em which is more important than “what” color as far as them being different.

    I appreciate the replies!

  • 1 Votes
    5 Posts
    413 Views
    guy038G

    Hello, @hellena-crainicu and All,

    Before giving, in the second part of this post, the specific solution for @hellena-crainicu, here is a simple example to show you the difficulties I had to face !

    Let’s start with this text :

    ---000000---DEF--- START---12345---6789---1111199999---DEF---STOP ---GHI---000 00000--- START---123---PQR---456---789STOP ---00000000---00---GHI---0000--- START987---AAA---654 ---ZZZ---321---STOP ---0000---000000000

    And let’s suppose that we want to rewrite all numbers, between the boundaries START and STOP, each on a new line

    If, in addition, we want to add a line-break, after the START opening section, we need, from the generic regex, discussed before by @peterjones, to slightly modify this regex, as we search for two independent strings, simultaneously. It leads to the regex S/R :

    (A) SEARCH (?sx-i)(?: (START) | (?!\A)\G ) (?: (?!STOP). )*? (\d+ (\R)? ) (A) REPLACE (?1\1\r\n\r\n)\2(?3:\r\n)

    and would change the initial text as :

    ---000000---DEF--- START 12345 6789 1111199999 ---DEF---STOP ---GHI---000 00000--- START 123 456 789 STOP ---00000000---00---GHI---0000--- START 987 654 321 ---STOP ---0000---000000000

    As you can see :

    The START boundary is clearly defined

    The different numbers, located between START and STOP are correctly rewritten one per line and extra stuff is deleted

    However, between the last number and the closing boundary STOP, some extra characters are still not deleted :-(

    No problem, we may modify this S/R to include the search of STOP, too, within a non-capturing group, giving :

    (B) SEARCH (?sx-i)(?: (START) | (?!\A)\G ) (?: (?!STOP). )*? (?: ( \d+ (\R)? ) | (STOP) ) (B) REPLACE (?1\1\r\n\r\n)(?2\2(?3:\r\n))(?4\r\n\4)

    And we will take the opportunity to add a line-break, right before the closing section STOP

    Thus, we obtain :

    ---000000---DEF--- START 12345 6789 1111199999 STOP000 00000 123 456 789 STOP00000000 00 0000 987 654 321 STOP0000 000000000

    Unfortunately, it seems that the 0 digits are also processed like the other numbers, although they are not part of a START •••••STOP region :-((

    Indeed, after matching some stuff ending with STOP, the search process restarts immediately and considers the following characters as we have specified the (?s) modifier ! So, how to tell the regex engine, to directly jump to the next START boundary ?

    I had the idea to only search for the beginning of the STOP string, for instance the string ST and add a negative look-behind (?!OP), executed once only, after the START string or location of the previous match

    So :

    First, extra chars before STOP as well as ST are changed as the string \r\nST

    Now, the regex engine is located right before the OP string of the word STOP. However, due to the look-ahead (?!OP), it must advance of one position in order that the condition (?!OP) is true. As this new match do not start where the previous match ends, the \G assertion forces the failure of the match attempt !

    Thus, the string OP and further stuff should not be modified and the new match would necessarily catch an other string START, so the beginning of an other allowed region !

    (C) SEARCH (?sx-i)(?: (START) | (?!\A)\G ) (?!OP) (?: (?!STOP). )*? (?: ( \d+ (\R)? ) | (ST) ) (C) REPLACE (?1\1\r\n\r\n)(?2\2(?3:\r\n))(?4\r\n\4)

    After replacement, we get :

    ---000000---DEF--- START 12345 6789 1111199999 STOP ---GHI---000 00000--- START 123 456 789 STOP ---00000000---00---GHI---0000--- START 987 654 321 STOP ---0000---000000000

    This time, it easy to see that the parts of text :

    Before the first START boundary

    After a STOP boundary and before a START boundary

    After the last STOP boundary

    Are not modified at all by the replacement, as expected !

    Now, @hellena-crainicu, as promised, here is the regex S/R to achieve what you want :

    SEARCH (?s)(?:^\h*(<!-- MAIN START -->)(?:\h*\R)+|(?!\A)\G)(?!->)(?:(?!<!-- MAIN FINAL -->).)*?(?:^\h*(<p class=".+?</p>(\R)?)|^(?:\h*\R)*\h*(<!-- MAIN FINAL -))

    REPLACE (?1\1\r\n\r\n)\2(?3:\r\n)\4

    You may test it against this sample text, below, containing two sections <!-- MAIN START --> ••••• <!-- MAIN FINAL -->, embedded into three other sections !

    <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p> <!-- MAIN START --> <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p> <!-- MAIN FINAL --> <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p> <!-- MAIN START --> <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p> <!-- MAIN FINAL --> <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p>

    You should get the expected text :

    <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p> <!-- MAIN START --> <p class="my_2">I love myself</p> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> <!-- MAIN FINAL --> <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p> <!-- MAIN START --> <p class="my_2">I love myself</p> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> <!-- MAIN FINAL --> <div align="center"> <table width="33" border="0"> <tr> <td> <h1 class="tre" itemprop="sfe">Text here</h1> </td> </tr> <tr> <td class="rest">Something, by Author</td> </tr> </table> <h2 class="blast2"><img src="sfa.jpg" alt="hip" /> <map name="goon" id="m2_34"> <p class="my_2">I love myself</p> <area shape="rect" coords="45,74,582" href="#plata" alt="" /> </map> </h2> <p class="my_2">Why this text text?</p> <p class="my_3">test text text</p> <p class="my_2">test text text</p> <p class="my_3">test text text</p> </div> <p align="justify" class="justify_em">Yes</p>

    Using the free-spacing mode, the search regex can be re-expressed as :

    (?xs-i) # FREE-SPACING mode, regex DOT match ANY character and search is SENSITIVE to CASE (?: # START of the 1st NON-CAPTURING group ^\h* # Any LEADING BLANK characters, followed with ... (<!--[ ]MAIN[ ]START[ ]-->) # The string '<!-- MAIN START -->', STORED as group 1 (?:\h*\R)+ # And followed with BLANK or EMPTY lines, in a NON-CAPTURING group | # OR (?!\A)\G # The EMPTY location RIGHT AFTER a previous MATCH ) # END of the 1st NON-CAPTURING group (?!->) # If the TWO NEXT chars are DIFFERENT from the string '->' (?: # START of the 2nd NON-CAPTURING group (?!<!--[ ]MAIN[ ]FINAL[ ]-->). # If CURRENT character is NOT the BEGINNING of the string '<!-- MAIN FINAL -->' ) # END of the 2nd NON-CAPTURING group *? # The SHORTEST, possibly EMPTY, range of ANY character, till... : See •, below (?: # START of the 3rd NON-CAPTURING group ^\h* # • Any LEADING BLANK characters, followed with ... ( # START of group 2 <p[ ]class=".+?</p> # The SHORTEST, NON EMPTY, range of characters between the strings '<p class="' and '</p>' (\R)? # And followed with an OPTIONAL line-break, STORED as group 3 ) # END of group 2 | # OR ^(?:\h*\R)*\h* # • An OPTIONAL range of BLANK or EMPTY lines, followed with OPTIONAL HORIZONTAL BLANK chars (<!--[ ]MAIN[ ]FINAL[ ]-) # And followed with the string '<!-- MAIN FINAL -', STORED as group 4 ) # END of the 3rd NON-CAPTURING group

    Notes :

    In this mode, any literal space char must be escaped with the \ character or written [ ] !

    Following the same method, as previously described, we just search for the ending string <!-- MAIN FINAL - and the last two chars -> are inserted in the negative look-ahead (?!->)

    Best Regards,

    guy038

  • 0 Votes
    2 Posts
    133 Views
    PeterJonesP

    @arulanand ,

    I don’t use WebEx anymore (it’s been a few years), so I’ve never seen that issue. However, sometimes screen sharing and remote controlling software of that type will highjack one of the Ctrl and/or Alt keys for its own internal use. You might be able to use right-Ctrl vs left-Ctrl or right-Alt vs left-Alt for making sure that Notepad++ sees the modifier key instead of WebEx highjacking it.

  • Document lost

    6
    0 Votes
    6 Posts
    242 Views
    Frozy ESOF

    Nevermind, found it.

  • How to avoid Insertion of tab

    15
    1 Votes
    15 Posts
    17k Views
    Allan FordA

    Option now (version 7.9.5 May 2021) … as per Settings > Preferences > Language > Tab Settings … Check the “Replace by space” option.

  • document jumps out of sight because shorter than scrollbar thinks

    4
    0 Votes
    4 Posts
    250 Views
    Bill KristyB

    @Michael-Vincent That solved it, thank you a billion times!!!

    @Terry-R Wow, thank goodness I don’t have THAT problem, how bizarre!

  • Column mode not working

    4
    0 Votes
    4 Posts
    1k Views
    A LA

    ok… i figured it out.
    It looks like I had the Windows Magnifier running and it was intercepting the
    ALT+SHIFT+<arrow-key>

    Exiting the Windows Magnifier fixed the issue.

  • Replace In files based on a condition

    30
    1 Votes
    30 Posts
    7k Views
    guy038G

    Hi, @akshay-kapoor and All,

    I must apologize ! When I said that you didn’t specify that your text began with leading space or tabulation characters, it was not very fair :-(

    Indeed, any coding man knows that lines of code, generally begin with blank chars and I should have considered this fact in my original search regex !

    So, sorry for the need of your second post !

    Enjoy Notepad++

    BR

    guy038

  • Regex: Find this 3 words within the range of 8 words

    10
    0 Votes
    10 Posts
    2k Views
    pbarneyP

    @guy038, wow. This is some next-level regexing from my point of view. You need a tip jar for that kind of work!

    Actually, now that I think of it, regex-for-hire might be a useful thing.

  • Highlighting breaks

    11
    0 Votes
    11 Posts
    2k Views
    General CoderG

    @PeterJones Yeah I understand. I was hoping to get some direction and explanation and you gave those so ty for that. Bug report has now been created: https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9852

  • Increment all numbers between brackets in a text

    4
    0 Votes
    4 Posts
    327 Views
    Alan KilbornA

    @Robin-Cruise said in Increment all numbers between brackets in a text:

    can you tell me what does ?<= do ?

    If you look HERE you will see it is a “lookbehind” assertion:

    aa0dd4f5-a842-4c94-a221-6d8b516911d6-image.png

    Thus, it is something that has to come before the match, but isn’t part of the match itself.

  • Open Notepad++ and do filecompare

    4
    0 Votes
    4 Posts
    671 Views
    Han KortekaasH

    Michael and Peter, thanks we’ll look in to that

  • 0 Votes
    26 Posts
    58k Views
    guy038G

    Hi, @alan-kilborn and All,

    No, just a personal presentation, in a Word document, of some parts of this article that I made some years ago, to fully understand the UTF-8 encoding ;-))

    My first table is simply the extension to the complete UTF-8 encoding of the Unicode table, seen here, which is able to encode all the Unicode characters ( 1,114,112 )

    With the complete UTF-8 encoding, up to six bytes, it can represent up to 134,217,728 characters ( so from U+0 to U+7FFFFFF )

    As you can see, no problem for UTF-8 to encode all characters used in the different inhabited worlds of the galaxy !!!

    And my second table is simply an other presentation of this one, on Wikipedia

    BR

    guy038

  • How to stop Notepad++ inserts parentheses and commas in new lines

    6
    0 Votes
    6 Posts
    2k Views
    M

    @PeterJones

    I started to test the plugins as you said.

    But something told me that the problem is with one of the Npp* plugins.

    After remove all and reinstall them one by one, I discovered the cause of the problem, the NppCalc plugin.

    This plugin is responsible for evaluating different expressions in Notepad++.

    After it is installed, it remains “active” by default.

    To turn it off, you have to unmark its “Active Calc” menu option or pressing “Ctrl + Shift + C”.

    Reading its description again, it is written:

    Evaluate expressions in Notepad++. ... Q: How does this work? A: Just type function name and press Enter!

    So, if the line has something that can be interpreted as an expression, it evaluates it after you press <ENTER> and shows the result as a new line.

    For example, a line without commas and with just the period in the sentence will not be evaluated. Otherwise, it will be read as an expression.

    Well,

    I can’t remember when and why I installed it, but I think it could be improved by changing the keys to run it or started it inactive after installed.

    Thanks for your attention and support.

    Cheers!!!

  • Notepad Freezing

    1
    0 Votes
    1 Posts
    120 Views
    No one has replied