• Replace xml tagging

    19
    0 Votes
    19 Posts
    2k Views
    PeterJonesP

    @Richard-Howard

    I’m starting to get the hang of it ( I hope :) ).

    8c6c8f1b-419f-442f-be6e-48912be41cc0-image.png

    It worked. Good job. :-)

    And a note: one of the things I like about this site, compared to certain stack-based exchange forums, is that this site doesn’t limit you to “one right answer”; many times, there are multiple posts in a discussion that help lead to a final answer, and I like being able to reward them all.

  • Regex help: Find/Replace only on lines that include specific words

    11
    0 Votes
    11 Posts
    971 Views
    guy038G

    Hi, @비공개, @alan-kilborn, @Neil-schipper and All,

    OK, @비공개, I’m going to give some pieces of information but, as always :

    You have to know how to make cement before you can put two bricks together

    You must know how to put two bricks together before building a wall

    You must know how to build a wall before building a room

    You must know how to build a room before building a house

    and so on !

    In other words, check this FAQ which gives you the main links to learn regular expressions, from top to bottom ;-))

    Now, let’s go :

    ---------------------------------------------------------------------------------------------------------------------------------------------------------- Regarding MODIFIERS, generally met at BEGINNING of the regex, but which may occur at ANY location within the overall regex : (?-i) From this point, search care about letter's CASE (?i) From this point, search does NOT care about letter's CASE (?-s) From this point, any regex dot symbol represents a SINGLE STANDARD character. So the . is UNICODE equivalent to the NEGATIVE class character [^\r\n\f\x{0085}\x{2028}\x{2029}] for an Unicode encoded file and equivalent to [^\r\n\f] for an ANSI encoded file (?s) From this point, any regex DOT symbol represents ABSOLUTELY ANY character, included all the LINE-ENDING chars (?-x) From this point, any LITERAL SPACE character is SIGNIFICANT and is part of the overall regex ( IMPLICIT in a N++ regex ) (?x) From this point, any LITERAL SPACE character is IGNORED and just helps READABILITY of the overall regex. This mode is called FREE-SPACING mode and can SPLIT in SEVERAL lines. In this mode : - Any SPACE char must be written [ ] or \x20 or escaped with a \ character - Any text, after a # symbol, will be considered as COMMENTS - Any litteral # symbol must be written [#] or \x23 or escaped as \# (?-m) From this point : - The regex symbol ^ represents only the VERY BEGINNING of the file, so equivalent to the regex \A - The regex symbol $ represents only the VERY END of the file, so equivalent to the regex \z (?m) From this point, the assertions ^ and $ represent their USUAL signification of START and END of line locations ( IMPLICIT in a N++ regex ) ---------------------------------------------------------------------------------------------------------------------------------------------------------- Regarding GROUPS : (•••••) It defines a CAPTURING group which allows, both : - The regex engine to STORE the regex ENCLOSED part for FURTHER use, either in the SEARCH and/or the REPLACE part - The regex ENCLOSED part to be possibly REPEATED with a QUANTIFIER, located right after (?:•••••) It defines a NON-CAPTURING group which only allows the regex ENCLOSED part to be REPEATED and which is **not** stored by the regex engine Note that the MODIFIERS, described above, may be INCLUDED within the parentheses : - In a CAPTURING group as, for instance, ((?i)•••••) so that the INSENSITIVE search is RESTRICTED to the contents of this group, only - In a NON-CAPTURING group, TWO syntaxes are possible : for instance : (?:(?i)•••••) or the shorthand (?i:•••••) CAPTURING groups can be RE-USED with the syntax : - \1 to \9 in the SEARCH and/or REPLACE regexes for reference to group 1 to 9 - $1 to $99 in the REPLACE regex ONLY for reference to group 1 to 99 - ${1} to ${99} in the REPLACE regex ONLY for reference to group 1 to 99 For instance, the ${1}5 syntax means contents of GROUP 1 , followed with digit 5 where as the $15 syntax would have meant contents of GROUP 15 - $0 or ${0} in the REPLACE regex ONLY for reference to the OVERALL math of the SEARCH regex ---------------------------------------------------------------------------------------------------------------------------------------------------------- Regarding QUANTIFIERS, 6 syntaxes are possible {n} , {n,}, {n,m}, ?, + and *. Note that : - {n} EXACTLY n times the character or group, PRECEDING the quantifier - {n,} n or MORE times the character or group, PRECEDING the quantifier - {n,m} BETWEEN n and m times the character or group, PRECEDING the quantifier - ? is equivalent to {0,1} - + is equivalent to {1,} - * is equivalent to {0,} They are considered as GREEDY quantifiers because they match as MANY characters as possible If these 6 syntaxes are followed with a QUESTION MARK ?, they are called LAZY quantifiers because they match as FEW characters as possible For instance, given the following sentence : The licenses for most software are designed to take away your freedom to share and change it - Regex (?-s)e.+?ar, with the LAZY quantifier +?, matches --------------------------- - Regex (?-s)e.+ar , with the GREEDY quantifier +, matches --------------------------------------------------------------------------- If theses 6 syntaxes are followed with a ADDITION sign +, they are called ATOMIC quantifiers. - They are quite similar to their GREEDY forms, exceot that, in case of failure, they don't backtrack to attempt further possible match(es) - Note that this ADVANCED option should be studied when you'll be rather ACQUAINTED with regexes ! ---------------------------------------------------------------------------------------------------------------------------------------------------------- BTW, a quick tip to SIMULATE a NORMAL search when the REGULAR EXPRESSION mode is selected : START the search zone with the \Q syntax : For instance, the regex \Q/* This is a C-comment */ will find the LITERAL string /* This is a C-comment */

    Now, I will rewrite my last regex, with your improvement, in the Free-Spacing mode :

    ---------------------------------------------------------------------------------------------------------------------------------------------------------- (?x-is) # FREE-SPACING mode, search SENSITIVE to CASE and DOT regex symbol represents a SINGLE STANDARD char (?: # BEGINNING of a NON-CAPTURING group ~~choice # Matches the string ~~choice, with this EXACT case | # OR ( ALTERNATION symbol ) (?!\A)\G # Matches from RIGHT AFTER the location of the LAST match, IF NOT at the VERY BEGINNING of the file ) # END of the NON-CAPTURING group .+? # The SMALLEST NON-NULL range of STANDARD characters till... \K # CURRENT match is DISCARDED and working location is RESET to this POINT (?<!\() # ONLY if it's NOT PRECEDED with a STARTING parenthesis symbol "[!'.?\w-]+" # ... a NON-NULL range of WORD chars or the characters !, ', ., ? and - (?!\)) # ONLY if it's NOT FOLLOWED with an ENDING parenthesis symbol NOTES : - This syntax is totally FUNCTIONAL. To be convinced do a NORMAL selection from (?x-is) to ENDING parenthesis symbol and hit the Ctrl + F shortcut => This MULTI- lines regex is AUTOMATICALLY inserted in the 'Search what' zone - The \G assertion means that the NEXT search must start, necessarily, RIGHT AFTER the LAST match ! - I rewrote your regex part [A-Za-z \-\.\!\?'] as [!'.?\w-] because most of the punctuation signs do NOT need to be ESCAPED, within a CLASS character. - However note that the DASH - must be found at the VERY BEGINNING or the VERY END of the class character, when NON escaped - I prefer the \w syntax to [A-Za-z] because \w also INClUDES all the ACCENTUATED characters of foreign languages - You must use ONLY the REPLACE ALL button ( Do NOT click on the REPLACE button for SUCCESSIVE replacements : it won't work due to the \K syntax ! ) - If you don't tick the WRAP AROUND option, move preferably the CARET at the VERY BEGINNING of current file - From BEGINNING of file, as the regex engine must SKIP some LINE-ENDING characters to get a match, the \G assertion is NOT verified and the regex engine must necessarily look, FIRST, for a string ~~choice - Then, from RIGHT AFTER the word choice, it grasps the SMALLEST NON-NULL range of STANDARD chars .+? till a "•••••" structure, but ONLY IF NOT embedded between PARENTHESES itself ! - And, due to the \K syntax, ONLY the part "•••••" is the FINAL match desired - This FINAL part is changed with the REPLACE regex \($0\) which just rewrites the string "•••••" between PARENTHESES. The parenthesis symbols must be ESCAPED as they have a SPECIAL signification in REPLACEMENT - Then, from RIGHT AFTER the closing " char, as the regex CANNOT find any other ~~choice string, the (?!\A)\G.+? part, again, selects the SMALLEST NON-NULL range of STANDARD characters till an OTHER block "•••••", execute the REPLACEMENT and so on...

    In the example, below, in each second line ( Regex types ) :

    The dot . represents any char, found by the regex dummy part .+?

    The bullet represents any char, found by the regex useful part [!'.?\w-]

    The character " and the string ~~choice stand for themselves

    Text processed ~~choice(["Red", ("Blue"), ("Orange"), … ,"Purple"]) Regex types ~~choice.."•••"..........................."••••••" Match number BEFORE \K 1111111111 222222222222222222222222222 Match number AFTER \K 11111 22222222 Text processed ~~choice([("Red"), "Blue", "Orange", … ,("Purple")]) Regex types ~~choice..........."••••".."••••••" Match number BEFORE \K 1111111111111111111 22 Match number AFTER \K 111111 22222222 Text processed ~~choice(["Red", "Blue", "Orange", … ,"Purple"]) Regex types ~~choice.."•••".."••••".."••••••"....."••••••" Match number BEFORE \K 1111111111 22 33 44444 Match number AFTER \K 11111 222222 33333333 44444444

    I hope that you’ll find this article useful, in any way !

    However, let me add that the \G and \K assertions, as well as atomic groups and recursive regexes or backtracking verbs ( not discussed ), are difficult notions and I can assure you that there are a LOT of regex things that you need to know before starting to use them !

    Best Regards,

    guy038

  • 0 Votes
    2 Posts
    203 Views
    Terry RT

    @한성빈 said in Even before this update, Korean has been marked half the way down from the basic line.:

    Even before this update, Korean has been marked half the way down from the basic line.
    How can I fix it?

    I would say the font selected dictates where each character appears in relation to the line. It will also affect the ability to show some characters so when you try other fonts don’t be surprised if you lose the ability to even type the Korean characters.

    Terry

  • regex search replace \1 not working

    5
    0 Votes
    5 Posts
    2k Views
    Neil SchipperN

    @PeterJones said in regex search replace \1 not working:

    the \n will replace with just the LF character

    I wasn’t aware of that, and it’s good to know. I guess I assumed replace behaved like in some HLLs (printf in ‘C’, IIRC) which automagically terminate lines according to the conventions of the O/S.

  • regex: Match everything up to linebreak but not linebreak

    13
    0 Votes
    13 Posts
    3k Views
    Hellena CrainicuH

    I find the regex which I needed: \b\w+\b(?=[\w\s]+\|)

    and in Python should be:

    words = re.findall(r'\b\w+\b(?=[\w\s]+\|)', new_filename)

    thanks @Neil-Schipper You give me a good ideea ;)

  • Increase Font Size of UI

    2
    0 Votes
    2 Posts
    3k Views
    PeterJonesP

    @Satori ,

    I found how to increase the text in documents by default,

    You could have posted this in reply to your other post, rather than starting a new topic, so I would know that you’d already figured out before I started my reply.

    but the menu text itself is still quite difficult to read.

    That’s a Windows OS setting. Notepad++ inherits that size from Windows.

  • 1 Votes
    2 Posts
    2k Views
    PeterJonesP

    @Satori said in How to Set a Larger than 28 Default Font Size OR Set a Default Zoom Size:

    Other Options?:
    If anyone knows of other ways that might get to this result, I’d love to hear them!

    The dropdown only goes to font size 28. However, if you set a bigger value in the right config file, it will default to larger than that.

    See OnlineUser Manual: Config Files: Editing Config Files for general hints about editing Config Files, but for you, the following should work:

    Close Notepad++ Open %AppData%\Notepad++\stylers.xml E:\Notepad++\stylers.xml [note1] [note2] in either Notepad++ or in another editor Change the line <WidgetStyle name="Default Style"... to set fontSize="64" or whatever huge font you want Save stylers.xml and exit the editor Launch Notepad++; the new, bigger font size should be in effect. Please note that Style Configurator > Default Style > Font Size will show up as blank now, because it’s not in the list of available dropdown sizes.

    ----

    notes note 1: for a normal installation, it would be in %AppData%\Notepad++\stylers.xml, but I saw your Debug Info (thanks!) showed you were using local config mode, so I adapted my answer; this note is primarily for future users who don’t have NPP on the E: drive. note 2: if you have a theme selected, it will be E:\Notepad++\themes\<themename>.xml or %AppData%\Notepad++\themes\<themename>.xml instead
  • How do I get rid of this?

    2
    0 Votes
    2 Posts
    278 Views
    Alan KilbornA

    @Luis-Piña-III

    If you mean “How do I make the cursor not blink?” then what you do is set the Blink rate to S for “slow”:

    837fc566-2faa-4fd9-ac73-eee98356ba1a-image.png

    Drop the Settings menu and choose Preferences… to get there.

  • Opening .CFM files

    2
    0 Votes
    2 Posts
    652 Views
    PeterJonesP

    @Pete-Lucas ,

    “Not responding” generally means either the OS or CPU is overwhelmed – either because Notepad++ itself is using too many CPU cycles (which I almost never see except in giant regex searches, though other people occasionally report it) or because another app is taking so many cycles that Notepad++ gets only occasional cycles and cannot complete normal tasks. So you would have to do things like look at the Windows OS tools Task Manager and/or the Resource Monitor to see how much CPU is being used by other apps vs. Notepad++.

    Often, people report Notepad++ slows down (or stops responding) when it’s trying to do a big search-and-replace (which isn’t what you’re doing, since you’re just loading a file). Or if it’s a humongous file (>100Mb) and it’s trying to do a lot of syntax highlighting – but since your file type is .cfm, and Notepad++ doesn’t by default have a syntax highlighter associated with that filetype, so that’s probably not it. (Also, you say “simple”, so I am assuming small. Is .cfm a ColdFusion Markdown file for you? That’s what a quick search for that file extension guesses, but you don’t tell us.)

    You might have a plugin that’s trying to do something with a .cfm file. If you shared your ?-menu’s Debug Info, it would tell us what plugins you have installed. And if you wanted to try with the -noPlugin command line option, it would disable all plugins… if -noPlugin makes it suddenly work 100% reliably, then you’ll want to go through and figure out which plugin is causing the slowdown.

    Alternately, maybe the .cfm file was on a network drive or a shared drive (so that it had multiple people accessing, or you are accessing across a network), or maybe some other medium that was being slowed down because some other application was accessing the drive at the same time, not allowing Notepad++ to correctly read the file.

    Or maybe you had a file from a network or shared drive in your Recent Files History; if so, go to Settings > Preferences > Recent Files History and check the checkbox for “Don’t check at launch time”, which as explained in the manual will avoid checking if files in the Recent Files History still exist.

    Mostly, you’ve given very little to go on, so I had to make guesses based on the normal causes of slowdowns. There is nothing inherent about the .cfm file extension which causes Notepad++ to stop responding, so the problem is likely somewhere else … and the hints above will help you try to solve or workaround the problem.

  • Icon is Ugly

    1
    0 Votes
    1 Posts
    405 Views
    No one has replied
  • 0 Votes
    5 Posts
    622 Views
    Keith KeplerK

    Basically you need to modify the startup behavior of Notepad++ via Windows Compatibility tab.
    You can get here many ways, I’m just using task manager since I had notepad++ open.

    Start notepad++ CTRL+ALT+DEL - open task manager. find notepad++ and right click on it and select --> Properties. Click the Compatibility tab Click Change High DPI Settings Check “override high DPI scaling behavior” and set it to Application
    Manual DPI Awareness setting.png
  • 0 Votes
    4 Posts
    854 Views
  • How can I find $ with regular expression?

    2
    0 Votes
    2 Posts
    3k Views
    PeterJonesP

    @Pierluigi-Vitiello ,

    Regular expressions have a concept called “escaping”, where you put a \ before the special character, and it turns it into a literal character. So if you want to search for a literal dollar sign $ rather than the end-of-line that the symbol means in a regular expression, search for \$ instead of $.

    see the docs at https://npp-user-manual.org/docs/searching/#single-character-matches for more on the escaping sequence.

  • 0 Votes
    7 Posts
    2k Views
    Alan KilbornA

    I think * is used for comments

    This construct is used for comments within a regex:

    (?# … )

    So, for example:

    (?# I am a comment )

  • Search Selection wrapping no longer seems to work

    2
    0 Votes
    2 Posts
    190 Views
    j fJ

    Sorry answered my own question. it is a setting in Preferences -> Searching
    Don’t fill find field… was checked

  • there is a plugin for inster sequence numbers?

    4
    0 Votes
    4 Posts
    2k Views
    Neil SchipperN

    @Extreme-Gio Something about your reply (maybe the words “old method”) reminded me of something I put together a while back which was very easy to repurpose to meet your need (completely outside of Notepad++):

    @echo OFF rem -- Cellvars.cmd -- Ref: https://community.notepad-plus-plus.org/topic/21946/there-is-a-plugin-for-inster-sequence-numbers rem x is start index, gets incremented; set x=0 rem xp is the leading padding string used in the var name; stays constant; it's length should be the number of 0's needed while x is a single digit set xp=0 REM set tot num of vars needed set count=17 DEL /P out1.txt :LOOPN9 set x2=%xp%%x% REM the number after the ~- should be (length of xp) + 1; example: for 500 vars, need xp=00, and use :~3 in next command echo var cell%x2:~-2%=Math.round(msg.payload.minutely[%x%].precipitation *600) /10; >>out1.txt set /a x=%x%+1 if %x% LSS %count% GOTO LOOPN9

    Save it to new file Cellvars.cmd and execute it at command prompt. Output goes to a file called out1.txt so make sure there’s no local file with that name that you need to keep.

  • Folding in HTML?

    3
    0 Votes
    3 Posts
    340 Views
    PeterJonesP

    @Name-Private ,

    But it folds to the very end of my code/text?

    For UDL folding in comment, it works just like described at https://ivan-radic.github.io/udl-documentation/folding-in-comment/ , which you can get to from the link in the UDL dialog:

    If I make a quick UDL that just defines comments like HTML comments: <!-- this is a comment --> Then I can use Folding in comment style, like described at https://ivan-radic.github.io/udl-documentation/folding-in-comment/ <!-- openFold --> stuff here <!-- middleFold --> blah <!-- closeFold --> outside of folding-in-comment

    which if that UDL is active will show up as:
    469ad9e8-59dd-4b97-8731-c80d7520af18-image.png
    … and then when folded:
    489627f2-1473-44bf-addd-4603c6faf1f2-image.png

    Note that the folding begins and ends with the keywords defined.

    Also, is it possible to add this folding function into the already existing HTML language?

    You cannot combine folding from a UDL and folding in a builtin syntax highlighter like HTML, sorry. Only one lexer – either UDL or a builtin – can be active at a time.

  • newest np++ doesnt find anything via [search in files]

    3
    0 Votes
    3 Posts
    204 Views
    BeatBullzB

    deleting the * stars in front and back of the search-phrase did it *facepalm

    thx a lot for your effort n time to help me

  • Deleted file, can't restore it no matter how hard I try

    6
    0 Votes
    6 Posts
    386 Views
    Lu BerL

    Thank you for a great and extensive reply - I’m not used to using explorer [I use Free CommanderXE donor ], however I did try find C:…AppData without success. The %AppData% worked a treat and I found the back ups. Unfortunately this was 0030 Melbourne Australia time and I switched off. Today [0911 Melbourne Australia] I fired up again and, of course the backups were over written but all the other tab contents were there but not Z, title of missing one]. My fault entirely, I tend to use and resort to manuals if necessary- pain in the posterior, I write manuals for sport so I’m used to read ^%$&#manual.

    My system is a Raid 5 and should be bog standard, The ? I didn’t realise had this debug info, viz
    Notepad++ v8.1.5 (32-bit)
    Build time : Sep 26 2021 - 15:15:32
    Path : C:\Program Files (x86)\Notepad++\notepad++.exe
    Command Line :
    Admin mode : OFF
    Local Conf mode : OFF
    Cloud Config : OFF
    OS Name : Windows 10 Enterprise (64-bit)
    OS Version : 2004
    OS Build : 19041.1237
    Current ANSI codepage : 1252
    Plugins : mimeTools.dll NppConverter.dll NppExport.dll

    Although I notice your version is 2009, mine is 2004 on auto upgrade. So far Notepad++ is a great program and should come standard with all MS systems, all it needs is a smack system for people like me who don’t save manually. I think I was thinking does <save> save the doc on which I’m working only or the whole lot.

    Thanks again for your excellent reply. Lu

  • notepad++ crashed, all data in file is lost!

    5
    0 Votes
    5 Posts
    2k Views
    Alan KilbornA

    @PeterJones said in notepad++ crashed, all data in file is lost!:

    the first item in the change list addresses your issue. Good timing: same day fix

    Well, maybe not such good timing, as the data has been lost already. :-(

    But the really great news is that moving forward @User-Name can continue working just like always, without a concern that he should have an independent backup strategy in place for his valuable data. Thank goodness. :-)