• Replace string, but maintain substring (convert Markdown to HTML image)

    4
    0 Votes
    4 Posts
    748 Views
    guy038G

    Hi, @jeroen-borgman, and All,

    Thanks for your comment !

    The Free Spacing regex mode also allows you to place the different parts of your regex in consecutive lines, with possible comments after a # character, as below :

    (?x) # FREE SPACING regex mode (?-is) # DOT regex char = 1 STANDARD char and search SENSITIVE to case ^ # START of CURRENT line boundary ( Added to be more RIGOROUS ! ) \Q![](..\pregit\uploads\\E # LITTERAL string ![](..\pregit\uploads\ (.+?) # Part BETWEEN uploads\ and /media ( Group 1 ) /media # LITTERAL string /media (/.+?) # Image NAME ( Group 2 ) \) # LITTERAL string ) The ESCAPED form is necessary as PARENTHESES are REGEX chars ! .+ # REMAINING chars of CURRENT line scanned

    Just select all these lines and paste them in the Find what: field of the Find dialog ;-))

    Note that if your regex must contain a # char, just place use the escaped syntax \# or the character class [#]

    Cheers,

    guy038

  • How to insert Path+Filename in an already opened doc

    5
    0 Votes
    5 Posts
    529 Views
    Elodie CEMOIE

    @guy038

    Sorry, sorry,… I apologize !
    I had stopped to use N++ about a year ago because of other priorities , and I just restart…
    Thank you very much ,

  • Find and Replace characters in a column range using Regex

    3
    0 Votes
    3 Posts
    2k Views
    guy038G

    Hello, @bob-johnson, @terry-r and All,

    OK, Bob. Luckily your S/R does not change the columns order, as you just want to replace 1 char with a single char, too. So, given the sample text below :

    Column 4455555555 8901234567 0 ABCDE VWXYZ - 12345 # - at column 48 0 ABCDE VWXYZ - 12345 # - at column 49 0 ABCDE VWXYZ -BCDEFG 12345 # - at column 50 0 ABCDE VWXYZ A-CDEFG 12345 # - at column 51 0 ABCDE VWXYZ AB-DEFG 12345 # - at column 52 0 ABCDE VWXYZ ABC-EFG 12345 # - at column 53 0 ABCDE VWXYZ ABCD-FG 12345 # - at column 54 0 ABCDE VWXYZ ABCDE-G 12345 # - at column 55 0 ABCDE VWXYZ - 12345 # - at column 56 0 ABCDE VWXYZ - 12345 # - at column 57

    The following regex S/R :

    SEARCH (?-s)^.{49}.{0,5}\K-

    REPLACE .

    Tick the Wrap around option

    Click on the Replace All button

    And choose, of course, the Regular expression search mode

    It should modify the text, as expected :

    Column 4455555555 8901234567 0 ABCDE VWXYZ - 12345 # - at column 48 0 ABCDE VWXYZ - 12345 # - at column 49 0 ABCDE VWXYZ .BCDEFG 12345 # - at column 50 0 ABCDE VWXYZ A.CDEFG 12345 # - at column 51 0 ABCDE VWXYZ AB.DEFG 12345 # - at column 52 0 ABCDE VWXYZ ABC.EFG 12345 # - at column 53 0 ABCDE VWXYZ ABCD.FG 12345 # - at column 54 0 ABCDE VWXYZ ABCDE.G 12345 # - at column 55 0 ABCDE VWXYZ - 12345 # - at column 56 0 ABCDE VWXYZ - 12345 # - at column 57

    Notes :

    The first part (?-s) forces the regex engine to consider that dot ( . ) represents a single standard char only ( Not an EOL one )

    The special syntax \K, cancels any previous search, already matched, at current location of the regex engine and, in your case, just consider the last - character

    Best Regards,

    guy038

  • word wrapp settings are not saved

    3
    0 Votes
    3 Posts
    543 Views
    Anonym InkognitoA

    Thank you very much!

    The folder was write protected, after i set the permission to folder and files it still doesnt save the setting.

    The config.xml was hidden, so i set it to visible and changed the setting Wrap=“no” to Wrap=“yes”. After restart npp the word wrap was enabled.
    But then, if i disabled this setting with the button and restart npp the setting was enabled again (vice versa problem).

    Then i started npp one time with right click/admin rights and i noticed a change at the date from the config.xml file. From now on i can change the settings and everything worked now.

    Problem solved with your help.
    Thanks again :)

  • User Defined language with Select statement AND Select group

    1
    0 Votes
    1 Posts
    178 Views
    No one has replied
  • Chercher et remplacer des caractères alignés verticalement

    2
    0 Votes
    2 Posts
    491 Views
    PeterJonesP

    @hamadou-mana,

    Hello,

    I have a big problem and I would like an urgent answer.

    I am working on a large .txt file so I would like to replace a suite of vertically aligned data and do not really know how to do it:

    the characters present themselves as follows:

    1 8 1 1

    and I would like to have this:

    1 7 1 1

    Thank you for helping me

    Assuming that’s literally all you have, it would be easy enough

    find = 1(\R)8\11\11 replace = 1${1}7${1}1${1}1 search mode = regular expression

    The (\R) matches any newline, and saves it into “group 1”. The \1 in the find-expression refers to the value of group1. The ${1} in the replace expression does the same.

    If you’ve really got something that is more complicated than that (for example, multiple columns of data, or a non-constant search and/or replace, instead of always 1811 → 1711), you will have to give us a better example of what should and what shouldn’t change, with example data that more fully matches your needs. When giving example data, please highlight it and click the </> button, which will mark it up as “code”, so that the forum doesn’t interpret special characters as Markdown and thus use it for rendering your post; as code, the forum will present the exact data you paste.

    Please also study the official Notepad++ regex docs, as well as other resources listed in this forum FAQ

  • Preview in browser not working...

    2
    0 Votes
    2 Posts
    314 Views
    rinku singhR

    Try with working HTML file for preview

  • Why does removing CR work correctly for me and not for co-worker

    4
    0 Votes
    4 Posts
    291 Views
    Phyllis FultonP

    That’s exactly what we’re doing: changing Windows (CR LF) to Unix (LF) with visible line-endings turned on. One can see that the CRs go away and only the LFs are left.

    We always double-check it afterward by opening the file in regular Notepad because it’s written in our Standard Operating Procedure – someone, some time in the past, had a problem, but they did not document the problem. They only documented that you needed to check to be sure the conversion “took.” (Very helpful, thank you, person in the past).

    Thank you for looking at our problem. It’s baffling.

  • Is this "language" already available for download ?

    3
    -2 Votes
    3 Posts
    275 Views
    Elodie CEMOIE

    Thank you very much ! I am going to test it …

  • Remove unwanted CRLF in paragraphs

    4
    0 Votes
    4 Posts
    3k Views
    Jeroen BorgmanJ

    @guy038 Thanks for this, works like a charm!
    I will study the search syntax with the REGEX doc on the side to do this myself next time.

  • Double the value of all numbers that match a line search in an XML file?

    3
    0 Votes
    3 Posts
    552 Views
    dinkumoilD

    @computeteen5

    You could use the XML Tools plugin and some XSLT code to transform your document.

    The following XSLT code creates a copy of the input XML file but doubles the value of the BasePay nodes’ text:

    <?xml version="1.0"?> <xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output method="xml" omit-xml-declaration="no"/> <xsl:template match="@*|node()"> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> <xsl:template match="BasePay"> <xsl:copy> <xsl:copy-of select="@*"/> <xsl:value-of select="text() * 2"/> </xsl:copy> </xsl:template> </xsl:transform>

    Save this code as an *.xsl file and open your XML file with Notepad++. I assume that you have already installed the XML Tools plugin.

    While your XML file is opened in the active tab, go to (menu) Plugins -> XML Tools -> XSL Transformation. In the dialog popping up click on the ... button, select your XSL file from above and click the Transform button.

  • Updating to 7.8

    2
    0 Votes
    2 Posts
    223 Views
    EkopalypseE

    @Steven-Haymes said in Updating to 7.8:

    how does the “Upgrade Scintilla from 4.1.4 to 4.2.0” effect already installed plugins?

    I’m using 7.8 but I’m using portable versions only so can’t say something about installation procedure.
    The biggest differences for plugins is that those are able now to load their
    dlls from within the plugin directory but it is not forced that the plugin does it.
    In short, I did not experience any plugin problems but have to admit, that I do not use so many different plugins.

  • Double New Line

    3
    0 Votes
    3 Posts
    310 Views
    shdawsonS

    Success, thanks.

  • Hexeditor access violation

    2
  • Can a UDL delimeter style's Close be made to ignore tabbed new lines?

    5
    0 Votes
    5 Posts
    302 Views
    David CoburnD

    @Ekopalypse
    That’s…a very good point! It’s more efficient and less cluttered to just have a unique ending delimiter rather than modify the beginning of every line. Thanks!

  • work on several lines?

    6
    0 Votes
    6 Posts
    325 Views
    guy038G

    Hello, @zen2cool and All,

    If I understand you, correctly, you would like that, given the text :

    +====================== Ticket 16392 ======================= 1 6X50G GO MY LITTLE ONE 2.89 2.89 2.89 B 1 400G NEXP CAT STER STER 3.49 3.49 3.49 B TOTAL EUROS: 3.38

    You expect the text :

    1 6X50G GO MY LITTLE ONE 2.89 2.89 2.89 B 1 400G NEXP CAT STER STER 3.49 3.49 3.49 B

    Am I right about it ? If so, use this regex S/R :

    SEARCH (?-is)^.+Ticket.+\R\R|\RTOTAL EUROS.+\R

    REPLACE Leave Empty

    Best Reards,

    guy038

  • How to do multiple search for a list of strings

    3
    0 Votes
    3 Posts
    5k Views
    guy038G

    Hello, @arhack-bifrost, @Dinkumoil and All,

    I was away from the N++ community since more than a month ( see my post below )

    https://community.notepad-plus-plus.org/post/47895

    So, my reply may be out of date !

    However, the macro, below, with 2 almost identical parts, is able to first searches, recursively, for the expression variableNumber1 in all the files of your Folder_Path. Secondly, it searches, in the same way, for the expression variableNumber2 and, finally, shows the 2 successive search operations, in the Find Result panel :-))

    <Macro name="searchTest" Ctrl="no" Alt="no" Shift="no" Key="0"> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="variableNumber1" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1653" wParam="0" lParam="0" sParam="X:\The_path_of_MyFolder\" /> <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.c" /> <Action type="3" message="1702" wParam="0" lParam="800" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" /> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="variableNumber2" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1653" wParam="0" lParam="0" sParam="X:\The_path_of_MyFolder\" /> <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.c" /> <Action type="3" message="1702" wParam="0" lParam="800" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1656" sParam="" /> </Macro>

    Notes :

    Of course, you may add as many sections as you want to perform other searches ;-))

    The parameters value 800 means : 512 ( Direction = Down ) + 256 ( Wrap around ) + 32 = Search in sub-folders

    Two important remarks :

    Your initial macro, in your post, contains a syntax error. Indeed, the line : <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.c*"" />

    should be :

    <Action type="3" message="1652" wParam="0" lParam="0" sParam="*.c" /> Secondly, note that, in all caases, the absolute folder path, let’s say "X:\The_path_of_MyFolder\", must, necessarily, ends with a backslash symbol ( \ )

    Cheers,

    guy038

  • re-emergence of an old issue

    5
    0 Votes
    5 Posts
    348 Views
    Jim JulianJ

    @PeterJones Thanks for the redirect. I read more closely and made the change.
    Thanks again.

  • Find results - Copy name of files (without hits)

    2
    0 Votes
    2 Posts
    194 Views
    guy038G

    Hello @vasile-caraus and All,

    Not very difficult, indeed !

    Do your search in files ( Ctrl + Shift + F )

    Once the Find Result panel opened, right-click inside and choose the option Select all

    Hit the shortcut Ctrl + C ( Do NOT use the Copy option of the context menu ! )

    Open a new tab ( Ctrl + N )

    Paste the clipboard ( Ctrl + V )

    Now, in that new file, perform the following regex S/R :

    SEARCH (?-si)^(?:(Search).+|\x20\x20(.+)\(.+?\)$|\t.+\R)

    REPLACE (?1echo @OFF)(?2Del\x20\2\x20/p)

    Save this new file, in your N++ directory, as, let’s say Suppression.bat

    Execute the option Run > Run... ( of hit the F5 key )

    Type in the command cmd /k Suppression.bat

    Valid the suppression of each file, by answering y

    Close the DOS window

    Et voilà !

    Remark : If your prefer to delete all files in one go, change the Replace zone as (?1echo @OFF)(?2Del\x20\2)

    Best Regards,

    guy038

  • is there regex works for col ?

    9
    0 Votes
    9 Posts
    424 Views
    guy038G

    Hi, @gurikbal-singh and All,

    I was away from the N++ community since more than a month ( see my post below )

    https://community.notepad-plus-plus.org/post/47895

    So, my reply is probably out of date and may be obsolete !

    To strictly answer your question, if you want that the second column starts at column N, use the generic regex S/R :

    SEARCH (?-s)^.{N-2}\K\x20+

    REPLACE Leave Empty

    and click, exclusively on the Replace All button

    Thus, if you need that the second column starts, let’s say, at column 21, use the following S/R :

    SEARCH (?-s)^.{19}\K\x20+

    REPLACE Leave Empty

    Of course, the number N must be in the interval [a,b], where :

    a = Maximum length of column 1 + 1

    b = Minimum column starting column 2 - 1

    So, in our example : a = 17 + 1 = 18 and b = 31 - 1 = 30 => N must be in interval [18-30]

    Best Regards,

    guy038