• Find a specific sequence on every line

    12
    0 Votes
    12 Posts
    1k Views
    Alan KilbornA

    @Neil-Schipper said in Find a specific sequence on every line:

    it’s intriguing to imagine an engine behind a friendly interface asking users to specify key aspects of their requirements in natural language

    That would be, well, pure “magic”:

    444080f6-9b1c-4dc6-bad7-357552cc007e-image.png

  • Change case of 7th character

    3
    0 Votes
    3 Posts
    301 Views
    Richard HowardR

    @PeterJones said in Change case of 7th character:

    $1\L$2

    Thank you Peter!
    That worked perfectly!
    Appreciate it very much.

  • A bug report which needs someone to repeat

    10
    0 Votes
    10 Posts
    848 Views
    PeterJonesP

    @W-TX ,

    One must first maximize one pane and hide another to start to do a search.

    What part of “whether I’ve got the view collapsed (using the < or > arrow on the dividing line) to just primary, or just secondary” did you not understand? The “collapsed” is the correct terminology which aligns with your “maximize”. I even told you what I clicked to do that, which should have been enough to overcome any language barrier.

    Please search for a string, not a word

    A word is a string. The search engine makes no distinction.

    , alternately click an item in the document list pane and search result pane, prefer not to touch the file view pane

    I never touched the file view pane during that experiment.

    I am waiting for other people to repeat the procedure to reproduce the bug.

    You will likely be waiting a long time, unless you can provide a simpler way of reproducing the bug.

    finally get the bug removed by code designers

    If there really is a bug, and others could confirm it: even if you reported the bug 1000000 in this forum, it would do no good, and would not cause the code designers – who have not been told of the bug – to do anything.

    I will ignore all other unrelated opinions.

    I am unable to help you any further, because you ignore what I say or what I say is incomprehensible to you. Maybe someone else will find some other way to helo you. Good luck.

  • How to redock search results on the bottom of the Windows

    8
    0 Votes
    8 Posts
    17k Views
    F TF

    @Vicki-J-Tumia Thanks, It worked for me as well.

  • Password

    2
    -1 Votes
    2 Posts
    231 Views
    Alan KilbornA

    @Fred-Brown

    Why are you asking this question in a discussion forum where people discuss Notepad++ ??

    Suggest you find a more appropriate forum for it.

  • Draw colors to keywords then search with AND OR logic

    2
    0 Votes
    2 Posts
    852 Views
    Alan KilbornA

    This topic was first broached here: https://community.notepad-plus-plus.org/topic/21973

  • Regex: Insert a new line in files, only if that line not exist in files

    16
    0 Votes
    16 Posts
    1k Views
    Hellena CrainicuH

    thanks @guy038 and @Robin-Cruise

  • How can I replace a preinstalled language style with a user defined one?

    1
    0 Votes
    1 Posts
    442 Views
    No one has replied
  • How to get pure code line number for a *.vhd file?

    5
    0 Votes
    5 Posts
    685 Views
    W TXW

    @W-TX
    Here is exactly what I want to do:
    Search for “\n” for comment lines that start with “–”, excluding leading space characters, and empty lines.
    Replace with a space.

    After the Notepad++ shows the changed file’s line number, the pure code line number, click undo icon to return to prior status.

  • Dark Mode style for .ini & .properties files

    3
    0 Votes
    3 Posts
    1k Views
    dimizunoD

    @PeterJones,

    Thanks for the quick answer. The Style Configurator is very helpful and I can for sure live with that. I was just thinking that it might be unintentional that the same dark blue fg color as in the light theme (#0000FF) is used here on a dark background. Similar languages like YAML and CSS have changed to a lighter fg color so I thought INI and PROPERTIES might have been missed. As you said, the last releases had a couple of style adjustments / fixes in place as well.

    Thanks again for quick response.

  • File content upside down

    2
    0 Votes
    2 Posts
    995 Views
    Alan KilbornA

    @Gian-Matteo

    Not to just look at it that way.

    But if you want to actually change it to be that way, Line Operations on the Edit menu has a command called Reverse Line Order.

    Of course, you could execute that command, look at the result, and then Undo it.

  • Deleting full words after certain length (after 36 char)

    3
    0 Votes
    3 Posts
    364 Views
    Net BuyerN

    @Terry-R : Thanks for your help. Worked like charm.

  • Search for a text and copy the previous lines of codes

    27
    0 Votes
    27 Posts
    5k Views
    Scott NielsonS

    @guy038 Suppose if I don’t have a link, that is </a> and I am not sure what to put there (because it varies), will this RegEx work if I am using the same search strings that you typed above: (?s-i)((?<!abc)(?<!xyz)(?<!xxx).)*?\K</span>\s*</p>?

  • Update manually

    3
    0 Votes
    3 Posts
    333 Views
    Rick GrunwaldR

    Thanks for the reply… I will give this a try

  • Regex help

    4
    1 Votes
    4 Posts
    330 Views
    Alan KilbornA

    @Alan-Kilborn said in Regex help:

    leaving the $

    Hmm, for maximum clarity I should have said:

    …leaving off the $ …

  • Search, Find string with parentheses around it.

    3
    1 Votes
    3 Posts
    355 Views
    Richard HowardR

    @PeterJones
    Got it.
    Thanks!

  • Adding parentheses around xml tags.

    8
    2 Votes
    8 Posts
    1k Views
    Richard HowardR

    @Richard-Howard
    Just as a follow-up, this appears to have solved my need, saving me hours of edit time.
    Thank you!!

  • need help with Remove Unmarked Lines option

    3
    0 Votes
    3 Posts
    942 Views
    premkumar bhaskalP

    great. Thank you for the quick reply.

  • 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
    2k 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