• Find previous doesn't work

    4
    0 Votes
    4 Posts
    1k Views
    Alan KilbornA

    @Steven123 said in Find previous doesn't work:

    Do you have an example of a regex that doesn’t behave as expected when searching in reverse?

    I did some research and it appears the logic for disabling the feature was that certain regex do not produce the same matches when moving forward through a series of different matches as is produced when moving backward through the same text.

    It was deemed desirable from a user perspective to produce the same hits moving in either direction (otherwise users would put in bugs about this).

    The example cited was this one:

    find: t\w+

    on this text: to the test they travelled

    which, if you try an older version of Notepad++ where backward searches were allowed, it does indeed produces different results.

  • FTP problems

    7
    0 Votes
    7 Posts
    334 Views
    Pizza GarnieP

    A huge THANK YOU. Your video SOLVED my problem.

    (after adding the new record, we have to make a selection at the automatically addes line BEFORE pressing the close buuton. A terrible choice of double form editing on the same sreen. Withyout changing this dicutable way of doing, at least, making the automatic selection AT THE SAME TIME the automatically added line would be better).

    (not important : “Global cache” is in the global setting)

    Thank’s again. All is now OK.

  • The search and replace mode is broken?

    2
    0 Votes
    2 Posts
    226 Views
    Alan KilbornA

    @Al-___ said in The search and replace mode is broken?:

    but in the last one it is definitely broken.

    Maybe something else is broken.

    There is a text, I make a selection in it, and I look for the selected piece.

    That is a bit vague; can you be more specific?

    Assume you did this:

    select some text with one or more spaces in it go to Find window put a space character in the Find what box tick In selection checkbox press the Find All in Current Document button observe no hits in Find result window

    Is that right? If not, can you try that sequence?

    Hint: If I try that sequence with the Match whole word only checkbox ticked, I get no hits; otherwise I do get hits, so…see if that checkbox is ticked for you or not.

  • Is there a similar functionality? Hint for convolution groups.

    4
    0 Votes
    4 Posts
    546 Views
    TroshinDVT

    @Alan-Kilborn When you move the mouse pointer to the folding line, a popup pops up with the first and last line of the folding zone, demonstration:
    alt text

    this allows you to see the headers of hidden loops (for, while, etc.) and ifs.
    Is there such functionality, for example, a plugin?

  • How to return values against a certain Parameter

    6
    0 Votes
    6 Posts
    459 Views
    PeterJonesP

    ^.+File Number =|^.+D=
    Issue resolved.

    @Annin-Jacob,

    I am glad you got it working.

    However, there were no equal signs = in the example data you gave us, so it is impossible for the regular expression to have worked with the data you gave us. Either the data you gave us doesn’t match the data you used it on, or you have not given us the actual regular expression that really worked for you, or the forum has badly mangled one or both because you didn’t use the </> button in the forum to format your data and regex. In any of those cases, it would have been impossible for us to properly help you.

    I make this post, not because I expect @Annin-Jacob to ever come back and read any more here – though if they do, I hope they learn from this advice – but because I am hoping that other people who read this site will take this advice as an example of why it’s so important to give reasonable example data, and to use the formatting available in the forum to make sure to properly display the example text exactly as it’s pasted in.

    ----

    Do you want regex search/replace help? Then please be patient and polite, show some effort, and be willing to learn; answer questions and requests for clarification that are made of you. All example text should be marked as plain text using the </> toolbar button or manual Markdown syntax. Screenshots can be pasted from the clipboard to your post using Ctrl+V to show graphical items, but any text should be included as literal text in your post so we can easily copy/paste your data. Show the data you have and the text you want to get from that data; include examples of things that should match and be transformed, and things that don’t match and should be left alone; show edge cases and make sure you examples are as varied as your real data. Show the regex you already tried, and why you thought it should work; tell us what’s wrong with what you do get… Read the official NPP Searching / Regex docs and the forum’s Regular Expression FAQ. If you follow these guidelines, you’re much more likely to get helpful replies that solve your problem in the shortest number of tries.

  • Regex to match spaces in a URL

    3
    0 Votes
    3 Posts
    1k Views
    guy038G

    Hello, @progonkpa and All,

    I suppose that the following regex S/R sould do the job !

    SEARCH (?-is)(?:<img\x20+src="\K|\G)(?:\x20*([^"\x20\r\n]+)|\x20+)

    REPLACE \1

    Remarks :

    Due to the \G syntax, the initial location of the cursor must not be followed with space characters

    Tick the Wrap around option

    Select the Regular expression search mode

    Because of the \K syntax, click on the Replace All button, exclusively. ( Do not use the Replace button ! )

    Notes :

    If we use the Free-spacing mode (?x), this regex can be expressed as : (?x-is) (?: <img \x20+ src=" \K | \G ) (?: \x20* ( [^"\x20\r\n]+ ) | \x20+ )

    So the regex engine is looking for a string <img src=", first, with this exact case

    Then , due the \K syntax, anything being matched, so far, is canceled and the regex engine, now, searches, either, for :

    A non-null range of non-space characters, possibly preceded by space chars

    A non-null range of space characters

    Then, due the \G syntax, it searches, for the same ranges, as above, right after the location of the last match. If a match cannot be found, it tries, again, to find an other string <img src=" and so on…

    Note that the (?:...........) structures are non-capturing groups which do not store anything for further use, either, in search and/or replacement !

    In replacement, we only rewrite the non-space characters [^"\x20\r\n]+ stored in group 1

    Best Regards,

    guy038

  • Suddenly cannot type [ in Notepad++

    4
    0 Votes
    4 Posts
    7k Views
    Shrikant ShrinivasS

    Had the same problem today, 07-Dec-2020

    Initially thought there was a problem with the Keyboard, or some gaming settings had come on. But found that it was typing normally in every other program.

    Finally found the problem. It seems that I had accidentally pressed some key combination that had activated a shortcut that made the file Read-Only.

    Fiddling around, found a setting in Edit Menu. And removed the Read only status.

    Everything was normal immediately.

  • Regex for locating a line with two non-consecutive tab characters

    6
    0 Votes
    6 Posts
    377 Views
    Terry RT

    @glossar said in Regex for locating a line with two non-consecutive tab characters:

    I understand you. I, too, do ask askers to try first what they ask.

    I’m sorry if what we said has offended you. But I will reiterate my previous post. We aren’t a free bus service hop on and hop off at will.

    That said, I did offer up a solution for you. All you need to do is convert that into some regexes. My steps are such that these should be easy to code up for someone just learning regex. And if you were to do that and still miss getting what you wanted then show us what you had done. We’d be glad to guide you some more.

    From our point of view if we gave everyone the solutions they want without asking for something in return we’d be inundated with requests. It’s much like the proverb:
    “if you give a hungry man a fish, you feed him for a day, but if you teach him how to fish, you feed him for a lifetime”. My guidance is an attempt at teaching you how to “fish”.

    Terry

  • Regex for deleting a number in a line only if it is the only one

    10
    0 Votes
    10 Posts
    591 Views
    glossarG

    Hi @guy038 and @Terry-R ,

    Thank you both for your subsequent solutions. Alan’s @Alan-Kilborn formula have done the job, so I can’t even reproduce the problem now :P, but I’ll note yours just in case I need it again.

    Thanks again.
    glossar

  • Marking links for deletion

    2
    0 Votes
    2 Posts
    142 Views
    Alan KilbornA

    @Henk-ter-Heide said in Marking links for deletion:

    When I double click a link it gets opened in my browser and when I triple-click it, it gets marked and I can delete it.

    Triple-clicking selects the entire current line, including the line-ending, so your link must occupy the entire line for this to work. In general, though, it is not true that triple-clicking selects a link.

    Also, my experience is that the double-click logic also fires, so yes you will get your link opened in a browser before it is selected.

    However, I can’t replicate your other experiences, at least with Notepad++ 7.9.1.

  • I want to make a calculator but I like don't know anything

    5
    0 Votes
    5 Posts
    305 Views
    PeterJonesP

    @flamemaster46 ,

    Given your user name (“flamemaster” implies you like giving and/or receiving insults) and the posts you’ve made so far, I am guessing you are here to troll us.

    On the off chance you aren’t, and you’re really in need of this level of basics: Notepad++ is a text editor. You can use any text editor you want for programming in C++. We think that the features of Notepad++ like syntax highlighting and the available plugins make it a useful tool for entering the source code for C++ and many (any) other programming languages. However, this forum is not a generic programming forum; we aren’t here to answer any random programming questions you have – and we definitely aren’t here to help you go the “shortcut way” of learning c++, or telling you what you can program in c++. Just about any application you can think of, there’s probably a way to do it in c++; and as far as I know, any c++ code you can write, you can use Notepad++ as the text editor to write the code in. But Notepad++ is not a c++ compiler; it is a text editor – you have to have an external compiler in order to compile your c++ code into an executable.

    If you were interested in seeing how to run your compiler from inside Notepad++, I give examples elsewhere in the forum of how to use the NppExec plugin to run external compilers (just do an advanced search for “NppExec” and my user name).

    But if you’re just here to get or give insults, or otherwise troll us, please don’t bother; that’s not why we’re here.

  • Highlight non-breaking spaces

    2
    0 Votes
    2 Posts
    252 Views
    Alan KilbornA

    @Myvh

    There’s info HERE on that, and HERE also.
    Note that you may have to read down a bit into those threads, where more of what you are interested in occurs.

    Definitely doable, with a bit of effort.

  • Help support Perl6/raku language

    2
    0 Votes
    2 Posts
    231 Views
    EkopalypseE

    @abelfourier
    you can check here if there is already an UDL available
    or here on how to create one.

  • 0 Votes
    2 Posts
    151 Views
    EkopalypseE

    @Vyrre

    no, these settings change npp internal behavior for
    functions like find dialog etc…, these are not intended for
    building/simulating an IDE.
    I would recommend to use the excellent NppExec plugin
    which allows you to create different profiles to run different commands.

  • Function List and PL/SQL packages

    29
    0 Votes
    29 Posts
    26k Views
    Marco GonzalezM

    Hi guys, after a few little changes it seems to work now for all my Plsql files…
    <?xml version=“1.0” encoding=“UTF-8” ?>
    <!-- ==========================================================================\

    To learn how to make your own language parser, please check the following link: https://npp-user-manual.org/docs/function-list/

    |
    =========================================================================== -->
    <NotepadPlus>
    <functionList>
    <!-- ========================================================= [ PL/SQL ] -->
    <parser
    displayName=“SQL-mehods”
    id =“sql_syntax”
    commentExpr=“(?x) # Utilize inline comments (see RegEx - Pattern Modifiers)
    (?s:\x2F\x2A.?\x2A\x2F) # Multi Line Comment
    | (?m-s:-{2}.$) # Single Line Comment
    " >
    <classRange
    mainExpr =”(?x) # Utilize inline comments (see RegEx - Pattern Modifiers)
    (?mi) # case insensitive
    ^\h* # optional leading blanks
    (CREATE\s+(?:OR\s+REPLACE\s+)?)?PACKAGE\s+(?:BODY\s+)? # start-of-package indicator
    (?:\w+.)? # schema name, optional
    (?‘PACKAGE_ID’\w+) # package name
    (?s:.?) # whatever, until…
    ^\hEND(?:\s+\k’PACKAGE_ID’)\s*; # …end-of-package indicator
    " >
    <className><nameExpr expr=“(?i:PACKAGE\s+(?:BODY\s+)?)\K(?:\w+.)?\w+” /></className>
    <function mainExpr=“^\h*(?i:FUNCTION|PROCEDURE)\s+\K\w+\s*(([^()]))?“>
    <functionName><funcNameExpr expr=”\w+" /></functionName>
    </function>
    </classRange>
    <function mainExpr="^\h(CREATE\s+(?:OR\s+REPLACE\s+)?)?(?i:FUNCTION|PROCEDURE)\s+\K\w+\s*(([^()]*))?” >
    <functionName><nameExpr expr=“\w+” /></functionName>
    </function>
    </parser>
    </functionList>
    </NotepadPlus>

    I also indented it my own way, sorry for that, enjoy it!

  • How to unescape?

    14
    1 Votes
    14 Posts
    13k Views
    guy038G

    Hi, @gioacchino-piazzolla, @alan-kilborn and All,

    I agree that I could have written the first regex S/R to Escape these special characters as :

    SEARCH (\a)|(\x08)|(\f)|(\n)|(\r)|(\t)|(")|(')|(\\)

    REPLACE \\(?1a)(?2x08)(?3f)(?4n)(?5r)(?6t)(?7")(?8')(?9\\)

    But , in that case, any text is changed in a one-line text. Just give it a try with the change.log or license.txt file ! Don’t know if this syntax is expected by the OP ?

    Now, I added the single quote character as I remember that the TextFX plugin can escape/unescape the ' character !

    BR

    guy038

  • select lines with specific number of word it it

    9
    0 Votes
    9 Posts
    656 Views
    guy038G

    Hello @dimitrov, @alan-kilborn, @peterjones, @astrosofista and All,

    Two days later, I realize that my generic regex could be shortened a bit ! Reading, again, what I said in my previous post :

    Part WITHOUT Hi (Part WITHOUT Hi + Hi) x 4 Part WITHOUT Hi ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | | | | V V V V (?x-s) ^ ( (?! Hi ).)* ( ((?!Hi).)*? Hi ){4} ((?!Hi).)* $ # The INITIAL regex

    You may see, as I did, that the regex begins with “Part WITHOUT Hi” and ( “Part WITHOUT Hi” and “Hi” ) repeated four times. So, there is a redundant part in this expression !

    The initial regex should be, simply :

    ^ (Part WITHOUT Hi + Hi) x 4 + Part WITHOUT Hi $ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | | | V V V (?x-s) ^ ( ((?!Hi).)*? Hi ){4} ((?!Hi).)* $ # The INITIAL regex

    Thus, the four generic regexes to solve general cases are simplified :

    To match lines containing your string, whatever the case, as a whole expression, the number of times, within the range :

    (?i-s)^(?:((?:(?!(\bYour string\b)).)*?)(?2)){Your range}(?1)$

    To match lines containing your string, whatever the case, the number of times, within the range :

    (?i-s)^(?:((?:(?!(Your string)).)*?)(?2)){Your range}(?1)$

    To match lines containing your string, with its exact case, as a whole expression, the number of times, within the range :

    (?-is)^(?:((?:(?!(\bYour string\b)).)*?)(?2)){Your range}(?1)$

    To match lines containing your string, with its exact case, the number of times, within the range :

    (?-is)^(?:((?:(?!(Your string)).)*?)(?2)){Your range}(?1)$

    For instance, all the regexes, below, are valid :

    (?i-s)^(?:((?:(?!(\bHi\b)).)*?)(?2)){4}(?1)$

    (?i-s)^(?:((?:(?!(Hi)).)*?)(?2)){3,5}(?1)$

    (?i-s)^(?:((?:(?!(\bThis is a test\b)).)*?)(?2)){2,4}(?1)$

    (?-is)^(?:((?:(?!(\bThis is a test\b)).)*?)(?2)){2,4}(?1)$

    Just test them against this text below, pasted in a new tab : :

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---Hi----- ---Hi----Hi---- ---Hi----Hi-----Hi---- ---Hi----Hi-----Hi----Hi---- ---Hi----Hi-----Hi----Hi----Hi---- ---Hi----Hi-----Hi----Hi----Hi----Hi----- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ---This is a test----- ---This is a test----This is a test---- ---This is a test----This is a test-----This is a test---- ---This is a test----This is a test-----This is a test----This is a test---- ---This is a TEST----This is a TEST-----This is a TEST----This is a TEST---- ---This is a test----This is a test-----This is a test----This is a test----This is a test---- ---This is a test----This is a test-----This is a test----This is a test----This is a test----This is a test-----

    Below, a list of the different steps in the genesis of the generic regex which should help you to understand this tricky regex !

    ^ ( Part WITHOUT Hi + Hi) x 4 + Part WITHOUT Hi $ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ | | | V V V (?x-s) ^ ( ( (?! Hi ).)*? Hi ){4} ( (?!Hi).)* $ # The INITIAL regex (?x-s) ^ (?: (?: (?! Hi ).)*? Hi ){4} (?: (?!Hi).)*? $ # We change all GROUPS as NON-CAPTURING, add a LAZY quantifier and notice 2 IDENTICAL blocks ! ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯ ¯¯¯¯¯¯¯¯¯¯¯¯¯¯ Gr1 V (?x-s) ^ (?: ( (?: (?! Hi ).)*? ) Hi ){4} (?: (?!Hi).)*? $ # We create a NEW group 1 AROUND the FIRST block –– –– Gr1 V (?x-s) ^ (?: ( (?: (?! Hi ).)*? ) Hi ){4} (?1) $ # We replace the 2nd BLOCK by a SUB-ROUTINE CALL to GROUP 1 (?1) ¯¯ ¯¯ Gr1 Gr2 V V (?x-s) ^ (?: ( (?: (?! (Hi) ).)*? ) Hi ){4} (?1) $ # We create a NEW group 2 AROUND the FIRST string "Hi" Gr1 Gr2 V V (?x-s) ^ (?: ( (?: (?! (Hi) ).)*? ) (?2) ){4} (?1) $ # We replace THE 2nd string "Hi" by a SUB-ROUTINE CALL to GROUP 2 (?2) (?-s)^(?:((?:(?!(Hi)).)*?)(?2)){4}(?1)$ # We suppress the FREE-SPACING mode and DELETE any SPACE character (?i-s)^(?:((?:(?!(Hi)).)*?)(?2)){4}(?1)$ # We add the CASE modifier (?i-s)^(?:((?:(?!(\bHi\b)).)*?)(?2)){4}(?1)$ # We add the \b BOUNDARIES to get a WHOLE expression ^ | For the 3 LAST regexes, STOP the SELECTION at the $ sign

    You may test any of these regexes above, against the text below, pasted in a new tab. It matches only the line containing exactly four strings Hi !

    ---Hi----- ---Hi----Hi---- ---Hi----Hi-----Hi---- ---Hi----Hi-----Hi----Hi---- ---Hi----Hi-----Hi----Hi----Hi---- ---Hi----Hi-----Hi----Hi----Hi----Hi-----

    Best regards,

    guy038

  • paragraph line break

    33
    0 Votes
    33 Posts
    6k Views
    PeterJonesP

    @kracovwolf said in paragraph line break:

    do you know if the macros are stored in notepads settings

    This and other such questions are answered in the npp-user-manual.org website, which is linked inside Notepad++ as the ? menu’s Notepad++ Online Document entry.

    The location of config files is described in https://npp-user-manual.org/docs/config-files/ The macros section of shortcuts.xml is described at https://npp-user-manual.org/docs/config-files/#macros The overview of macros is found at https://npp-user-manual.org/docs/macros/
  • Setting a user file extension is not working

    7
    0 Votes
    7 Posts
    437 Views
    PeterJonesP

    @Alan-Kilborn said in Setting a user file extension is not working:

    is it possible

    Yes. Either put it as a UDL extension, or remove it from langs.xml

  • CMD.bat script - Error REG DELETE statement

    3
    0 Votes
    3 Posts
    285 Views
    BigstarblueB

    @dinkumoil

    I thank you for the interest you had in helping me. I really appreciate your help.

    You were absolutely right. The problem was with the 32-bit version of N++ I was using. I changed it to 64-bit and it worked perfectly.

    Explanation more than simple and clear !!!

    Thank you again,

    Bigstarblue