• find, replace and Capitalize All First Letters...

    2
    0 Votes
    2 Posts
    711 Views
    EkopalypseE

    @Ricky-Shaw

    select the words and if you haven’t reconfigured default shortcuts then press ALT+U,
    otherwise goto menu edit->convert case to->proper case

  • Delete to EOL

    3
    0 Votes
    3 Posts
    984 Views
    Jon AppelberghJ

    Thanks Peter, that is doing what I needed.

  • 3 Votes
    34 Posts
    5k Views
    piranpiranP

    @guy038 said:

    I just hope that these two regex S/R work nice, too, on your VERY BIG unordered ASN data list ;-))

    Delighted to confirm that your hack (the first one) delivered a proper sort of the large listing (AS7552).

    If you’re curious my kit took some 48sec compared to the inconsistent ‘results’ provided by 7.7.1 in (what would’ve normally have been) about a second.

    Thank you @guy038 for providing that workaround to the native code’s flawed 7.7.1 …for which I await a fix.

  • Need to Move the macros

    9
    0 Votes
    9 Posts
    1k Views
  • 0 Votes
    6 Posts
    3k Views
    andrecool-68A

    @Alan-Kilborn
    For the Author of the question, the direct route to this page is:
    https://www.w3schools.com/tags/tag_img.asp

  • PHP syntax not highliting when inside other language string (ver 7.7)

    10
    0 Votes
    10 Posts
    2k Views
    David WZD

    @Ekopalypse Yes it is, I didn’t see it.

  • Find and Replace in multiple subdirectories

    5
    0 Votes
    5 Posts
    1k Views
    Alan KilbornA

    @FFatih-SH

    So then in the Find in Files tab of the Find window, you would locate a checkbox for “subfolders” and tick it. Then you would specify C:\Users\LG\Desktop\Folder1\ as the “directory”…

    When you get it all set up, you press the Replace in Files button…

  • UDL Folding problems in ADA

    11
    0 Votes
    11 Posts
    1k Views
    EkopalypseE

    @Jose-Manuel-Vela-García

    hmmm … maybe some browser issue but if you search for ada you should get it as the first found item. Anyways here the direct link to the ada demo plugin/template.

  • How to write and execute a replace script by menu/hotkey?

    5
    0 Votes
    5 Posts
    1k Views
    Alan KilbornA

    @Claudia-Svenson

    You can record a macro for the replacement operation. See the Macro menu – fairly self-explanatory. The macro snapshot happens when one of the buttons is pressed (e.g. Replace, Replace All, etc).

  • Help me please, how can I extract the mail and the next column?

    6
    0 Votes
    6 Posts
    647 Views
    oscar remicccO

    @guy038
    you are a great teacher, thank you very much

  • Forum profile: my email is taken?

    5
    1 Votes
    5 Posts
    988 Views
    Giulio.PortioliG

    Thanks Peter. I can only guess I created an account a long time ago using email address and password (although I have no recollection, including of any username), but obviously I cannot access it any more, now that login is only via FB/GitHub etc.

    I’m more than happy to keep my current account @Giulio.Portioli, anyway. It’s any old account that should be deleted. I’ll try the website contacts, if no-one pipes in.

    Cheers.

  • (autoCompletion)additionalWordChars doesnt work?

    3
    0 Votes
    3 Posts
    575 Views
    andrecool-68A

    @PeterJones I can make a shorter post)))

  • color according to syntax language

    3
    0 Votes
    3 Posts
    744 Views
    Jorge Rojas V.J

    Perfect.
    Updating program.
    Problem solved.
    Thank you.

  • Need Macro to recursively change CRLF (windows) to LF (Unix)

    8
    0 Votes
    8 Posts
    3k Views
    dinkumoilD

    @Maurizio-Moretti , @andrecool-68

    Another approach is to use my AutoEolFormat plugin, available via PluginManager (up to Notepad++ v7.5.9) and PluginsAdmin (Notepad++ v7.6 and higher).

    Install the plugin. Configure it to automatically set EOL format for XML files to Unix style (LF). Open all XML files to convert (EOL format will be converted automatically). Click on Save all.

    To save RAM maybe do not open all XML files at once, open maybe 40 or 50 (depends on the size of the files).

  • Printing and spellcheck

    2
    0 Votes
    2 Posts
    401 Views
    andrecool-68A

    @Václav-Vlček
    If you are sure that the word is spelled correctly, you can add it to the user’s dictionary or turn it off from the spell checker.

  • Adding text to beginning and end of files for whole directory.

    2
    0 Votes
    2 Posts
    3k Views
    Terry RT

    @Andy-Ly said:

    add text to the beginning of the txt files and the end of it for the whole directory in bulk

    Welcome to the community.
    It can be done simply with Notepad++. The regex (regular expression) I’ve provided should be copied into the appropriate fields within “Find in Files” function. This can be found under the main menu option “Search”.

    Find What:^(?s).+
    Replace With:line 1\r\n$0\r\nlast line
    Filters: make this *.txt and the Directory should be where your group of files to edit are located. As a suggestion either copy a few select files to another location and test first, or make sure you have a complete copy of ALL the files before editing. And after performing these steps you should verify a few random files to be sure it has worked as planned.

    Note line 1 should be changed in the regex to the characters you wish to insert on the first line. and last line should also be changed to what you intend inserting at the end.

    To give some background the (?s) means that the . character will capture ALL characters including line feed/carriage returns regardless of what the setting is on the “Find in Files” option . matches newline.
    The .+ then allows it to capture the entire file contents.
    In the Replace With field first the new insertion is provided, then a newline (\r\n), then we return the captured contents of the file `$0 and finally add a newline and the new last line to be inserted.

    You did not mention if the first and last lines were to be new lines, but my regex makes it so with the use of \r\n. If you do NOT wish this, remove the 2 instances of \r\n before preceding with the changes.

    Please note that the “search Mode” MUST be “regular expression”. After hitting the “Replace in Files” you may be presented with a question, this allows you to stop if you did NOT mean to apply the changes. If you continue all the files will be updated.

    Check your results on a sample group of files before proceeding with the entire lot.

    Let us know how it went, if there were any issues etc. We may be able to further fine tune the solution if required but would need more information.

    Terry

  • Wildcard Search

    3
    0 Votes
    3 Posts
    1k Views
    guy038G

    Hello, @peter-mccormack, @terry-r and All,

    Terry, you said :

    We can expand on this and say \d{5,8} which asks for at least 5, and up to 8 digits together, tending to as few as necessary. A further expansion of this is to say \d{5,8}+ which says between 5 and 8 digits but more rather than less, so it’s greedy.

    I’m really sorry, Terry, but your reasoning, about lazy, greedy and possessive quantifiers, is not exact !

    First, if we consider, for instance, the general syntax A{2,9}, this defines 3 types of quantifiers :

    The greedy quantifier A{2,9} which tries to match as many letters A as possible, with a maximum of 9 letters A

    The lazy quantifier A{2,9}? which tries to match as few letters A as possible, so a minimum of 2 letters A

    The possessive quantifier A{2,9}+ which tries to match as many letters A as possible, with a maximum of 9 letters A, but which NEVER allows the regex engine to backtrack so that the overall pattern would match !

    Let’s suppose that our sample text, to test some regex syntaxes, is the simple string AAAAAAAAA ( 9 letters A ), in a new tab

    The regex (?-i)A{2,9}?A matches the string AAA : Logic, because A{2,9}? matches AA, as a lazy quantifier. Then A matches the third A, of course !

    The regex (?-i)A{2,9}A matches all the string AAAAAAAAA. Again logic, but this needs a quick explanation :

    First, the part A{2,9} matches the entire string AAAAAAAAA ( 9 letters ), but, now, there’s NO more text, to satisfy the last part of the regex A

    So, the regex engine backtracks and the part A{2,9} match the string AAAAAAAA (8 letters only ). This time, the reminder of the regex : A can match the 9th letter A !

    The regex (?-i)A{2,9}+A, with the possessive quantifier, matches nothing ! Do you understand the logic of this result ?

    Like above, the part A{2,9}+ matches the entire string AAAAAAAAA. And again, there NO more text which could be matched by A, the reminder of the regex !

    But, unlike the case above, due to the possessive quantifier, the regex engine is NOT allowed, this time, to backtrack. So, as the regex don’t have other alternatives, the regex engine cannot match our subject string and process stops !

    The slightly modified regex (?-i)A{2,8}+A, although containing a possessive quantifier, does match the entire string AAAAAAAAA ! I suppose you’ve already guessed why :-))

    First, the part A{2,8}+ although possessive, matches the string AAAAAAAA ( its maximum : 8 letters ) and the last part A of the regex matches the 9th letter A

    This time, NO need to backtrack : the overall pattern match our subject string AAAAAAAAA

    Keeping again our sample text AAAAAAAAA, let’s test some other regexes :

    The regex (?-i)A{2,9}?A{2,9}?, with two lazy quantifiers, matches the string AAAA ( 2 times the minimum of 2 letters )

    The regex (?-i)A{2,9}?A{2,9}, with a lazy quantifier, followed by a greedy one, matches the entire string AAAAAAAAA ( The first part A{2,9}? matches AA and the last part A{2,9} matches AAAAAAA )

    The regex (?-i)A{2,9}A{2,9}?, with a greedy quantifier, followed by a lazy one, matches, first, all the subject string :

    Indeed, the first part A{2,9} can match all the subject string ( 9 letters )

    As there NO more text for the last part A{2,9}?, the regex engine backtracks 1 position

    So, the first part A{2,9} matches the 8-chars string AAAAAAAA but the last part A{2,9}? cannot match the 9th letter A, as a minimum of two letters A is required !

    Again, the regex engine backtracks 1 position. So the first part A{2,9} matches the 7-chars string AAAAAAA

    This time, the last part A{2,9}? can match the string AA : Done !

    The regex (?-i)A{2,9}A{2,9}, with two greedy quantifiers, matches the entire sting AAAAAAAAA. Logic, as, like above, after two backtracking processes, the first part A{2,9} matches the 7-chars string AAAAAAAA and the last part A{2,9} matches the 8th and 9th letter A, so AA ( UPDATED 07-05-2019)

    The regex (?-i)A{2,9}+A{2,9}, with a possessive quantifier, followed by a greedy one, matches nothing. Why ?

    The first part A{2,9}+ matches the entire string AAAAAAAAA, at the beginning. But, as NO more text can be matched by the last part A{2,9} and that backtracking is not allowed because the quantifier is possessive, the process stops without any match !

    Finally, the regex (?-i)A{2,9}+A{2,9}?, with a possessive quantifier, followed by a lazy one, would produce the same results and gives no match

    You could say : So, what is the benefit of using possessive quantifiers ?

    First, to speed up regular expressions. In particular, they help some alternatives, of your regex, to fail faster !

    Secondly, they prevent the regex engine from trying all possible permutations. This can be useful for performance reasons !

    Thirdly, in case of nested quantifiers, for instance, they may save your day by preventing the regex engine from the catastrophic backtracking event :-((

    One example :

    Let’s imagine the regex (?-i)A*Z, against this sample text AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA, in a new tab

    The regex engine, due to the greedy quantifier, will backtrack 50 times to realize that, at any position, an uppercase letter Z cannot be found -((

    Let’s consider, now, the regex (?-i)A*+Z. This time, the possessive part A*+ grabs all the letters A and there NO more text to match the Z regex,. And, as backtracking is not allowed, the regex fails faster and so, the regex engine can search, for other matches, further on, more quickly !

    Of course, you don’t see any difference between the two cases but, for long texts and/or complicated regexes, this may be significant !!

    Finally, here is, below, a summary table of all the quantifiers :

    •--------------------------------------• | QUANTIFIERS | •---------------•----------•------------•--------------• | REPETITIONS | Greedy | Lazy | Possessive | •---------------•----------•------------•--------------• | From n to ∞ | {n,} | {n,}? | {n,}+ | •---------------•----------•------------•--------------• | From n to m | {n,m} | {n,m}? | {n,m}+ | •---------------•----------•------------•--------------• | From 0 to 1 | ? | ?? | ?+ | •---------------•----------•------------•--------------• | From 0 to ∞ | * | *? | *+ | •---------------•----------•------------•--------------• | From 1 to ∞ | + | +? | ++ | •---------------•----------•------------•--------------• | From n to n | {n} | •---------------•--------------------------------------•

    Note that the {n} quantifier cannot be qualified with the flavors Greedy, Lazy or Possessive. It just means exactly n times, the character or expression, right before !

    Best Regards

    guy038

  • Enable Session Snapshot and Periodic Backup Box Unchecked

    19
    3 Votes
    19 Posts
    5k Views
    AndreCunhaA

    I have had this problem for quite some time but have never bothered to go after it.

    Today, after once again losing a few scratch texts because of this ongoing issue, I have found this thread and also a few related open issues on Notepad++ Issues tracker:

    Issue: Default session’s unsaved files are lost (from session’s XML file) after closing Notepad++ in a different session ‘enable session snapshot’ gets disabled occasionally Saved Sessions lost Notepad++ resets my auto-backup setting after I perform a git commit with it. Backup is broken in several ways with multiple instances

    This is particularly unfortunate because Git installer for Windows itself actually offers to set up Notepad++ as the default editor for commits.

    Setting up a portable version just for this seems a bit too much, also it would then be annoying to manually keep both Notepad++ configurations in sync. It is sad, but I have decided to do the same as @Ron-Little and simply use Windows’ Notepad.exe for Git and avoid this problem altogether.

  • Saving a text file as an .html file

    8
    0 Votes
    8 Posts
    1k Views
    andrecool-68A

    @Yangos-Metaxas
    2.276 kb is about 5500 lines with bookmarks)))
    Nobody will fix it for you!

  • Delete line containg a word + previous line

    3
    0 Votes
    3 Posts
    512 Views
    guy038G

    Hello anass-chawki, and All,

    Quite easy with regexes ! So :

    Open the Replace dialog ( Ctrl + H )

    SEARCH (?-is)^.+\R.*/movie/.*\R

    REPLACE Leave EMPTY

    Tick the Wrap around option

    Select the Regular expression search mode

    Click once, on the Replace All button

    Et voilà !

    Remarks :

    If you’re looking for the word movie, in any case ( for instance /MOVIE/ or /MoviE/ ), change the first part of the regex (?-is) with the syntax (?i-s)

    On the other hand, if you want to delete the line containing /movie/ and a true empty line, above, use the syntax below :

    SEARCH (?-is)^.*\R.*/movie/.*\R

    Notes :

    First, the in-line modifiers (?-is) :

    Forces the search to be processed in a non-insensitive way

    Forces to regex engine to interpret any dot ( . ) as representing a single standard character, NOT EOL character(s)

    Then, the part ^.+\R looks for a complete non-empty line, with its EOL characters

    Finally, the part .*/movie/.*\R searches any range, even null, of standard chars .*, followed with the string /movie/, with that exact case, and finally followed with an other range, even null, of standard chars .* and ended with its EOL chars \R

    This selection of complete two lines is, then, deleted, due to the Empty replacement zone

    Best Regards,

    guy038