• Help with regex and find/replace

    Locked
    3
    0 Votes
    3 Posts
    778 Views
    MassimoM

    @PeterJones said:

    Welcom, @Massimo,

    I am assuming those are really normal-quotes, not smart-quotes. Please see this awesome thread which explains how to use markdown to format your posts, so that the forum doesn’t change you important characters into smart characters.

    Hi Peter, thanks for your help!

    Are smart-quotes that in dabase are saved as

    '

    This worked perfectly!

    Find

    data='([^']*)' pid='([^']*)' dateline='([^']*)'

    Replace with

    data=$1 link=msg=$2 date=$3

    Thanks again 😉

  • Converting columns to rows in a text file

    Locked
    2
    0 Votes
    2 Posts
    5k Views
    Terry RT

    @Trevor-Friswell
    there are a couple of ways of attacking this issue.

    First would be to open the CSV file in a spreadsheet app, likely Excel, but Open Office would also work. This would then put each field in a separate column. Then you’d pick 1 column at a time and save the data to a txt file.

    Second method is using Notepad++ to alter the data to suit by changing the commas separating each field into a “CR/LF”. I would also include an additional line feed at the end of each row, so that subsequent editing of the data could use this to help divide up the data in the separate files. Prepending a number at the beginning of each line (1 through 9) using the blank line would allow for a new sort of the lines to put them in the “file” groups. This is only a concept and may well require adjustment as one ventures through to a solution. Given some fields might have quotes around them if they have a comma within the data can further complicate matters.

    Personally, given the small amount of information you have provided I would go with the Excel idea.

    Note I haven’t actually provided any regexes (regular expressions) as obviously the example you provided is simplified (not real). All too often we try to help users where the information is limited, only to be told by the OP that in fact they “really need to do…” or that “the real data actually looks like…”. That is extremely frustrating and wasteful of time, often it can result in throwing out the solution, going back to the drawing board and designing another solution.

    I would like to point you to our FAQ, specifically:
    https://notepad-plus-plus.org/community/topic/15739/faq-desk-request-for-help-without-sufficient-information-to-help-you
    Please read that and if needing to provide more realistic data use the formatting suggestion so that the interpreter here does NOT alter your data.

    Terry

  • Editing in Notepad++

    9
    0 Votes
    9 Posts
    3k Views
    PeterJonesP

    You’re welcome, @Inshita-Rawat. If you follow the links in the FAQ, especially to one of the try-it-live websites, like regexr.com (*), they will explain the individual elements of the regular expression in great detail.

    *: I usually use regexr, and switch it from “JAVASCRIPT” to “PCRE” in the upper right. PCRE comes come close to Notepad++'s Boost-based regular expressions — since both Boost and PCRE are based on Perl regular expressions, though there are differences (both from each other, and from Perl).

    If you paste my ^(.*?) (\d.*) regular expression into regexr.com with PCRE, and FLAGS=global,multiline (/gm), along with example data – see https://regexr.com/466oe – you can see the explanation, or by clicking on REPLACE, you can input my replace string, and see what it will become.

  • Can not change UI Language to ChineseSimplified.

    1
    0 Votes
    1 Posts
    508 Views
    No one has replied
  • geektyper for notepad++ ?

    2
    0 Votes
    2 Posts
    992 Views
  • 0 Votes
    4 Posts
    2k Views
    Semper RotoS

    Hey @Meta-Chuh and @guy038,
    that’s some great news you sharing. I certainly will look into this.
    Thanks for the quick help.

    Best regards.

  • Keyboard map chords (e.g., Ctrl+X Ctrl+C)

    16
    0 Votes
    16 Posts
    5k Views
    Mikhail VM

    @Alan-Kilborn said:

    editor.styleSetBack(STYLESCOMMON.LINENUMBER, (255, 0, 0))

    will turn the background of the line-number margin a rather glaring red, for example.

    Yes, changing the line number color is actually better solution in general and it can be better visible.
    I’ve used folder margin from the beginning and just was too lazy to experiment further :)
    BTW, if you want to make permanently visible folder margin in any file, it can be done with Pythonscript plugin via “startup.py” script.

    Disable folder margin:
    Settings - > Preference -> Editing : set “Folder margin style” to “None” Add e.g. this to startup.py: editor.setMarginWidthN (2, 16) # set folder margin to 16 pixel editor.markerDefine (MARKEROUTLINE.FOLDEROPEN, MARKERSYMBOL.ARROWDOWN) editor.markerDefine (MARKEROUTLINE.FOLDERSUB, MARKERSYMBOL.EMPTY) editor.markerDefine (MARKEROUTLINE.FOLDERTAIL, MARKERSYMBOL.EMPTY) ...

    then Restart Npp. So can even define custom marker symbols or just set them all to EMPTY.
    see:
    https://www.scintilla.org/ScintillaDoc.html#Markers
    http://npppythonscript.sourceforge.net/docs/latest/enums.html#markeroutline

  • The strange behavior of the cursor in the Notepad + + window

    39
    0 Votes
    39 Posts
    17k Views
    andrecool-68A

    @SinghRajenM said:
    I do not have such an error

  • I am having trouble with notepad++

    2
    0 Votes
    2 Posts
    524 Views
    Alan KilbornA

    @KOMN-W said:

    I am having trouble with notepad++

    But you didn’t say anything about the trouble you’re having with Notepad++!

  • How to automatic open more files with one click

    1
    0 Votes
    1 Posts
    481 Views
    No one has replied
  • Delete all lines except

    16
    0 Votes
    16 Posts
    5k Views
    Meta ChuhM

    @PeterJones

    since two of the forum’s python experts are not actively helping here anymore, I need to up my PythonScript output …

    i really wished there was an easy way to lure both back somehow … for example with a complementary free cake for all returning members 🥧🍰🎂 :D

    i’ve still got the hope that someday maybe one or both will return for either historic, good times reasons, or 'cause you lured them back with future’s most ultimate py guru knowledge 👍
    (ps: no pressure, i think your py is already pretty good and way better than eg. mine)

    reader’s note:
    this was slightly off topic, so i give my sincere apologies to everyone in advance.

  • Issue when copypasting from excel to notepad++

    Locked
    7
    0 Votes
    7 Posts
    8k Views
    Meta ChuhM

    thanks @PeterJones , now i can reproduce.
    (i barely use excel so i didn’t even now that you can put a tab or a new line in a cell ;-) )

    now i definitively second your first suggestion using regex to replace the pairs of quotes:

    If you only want to get rid of matched quote pairs, then enable search mode = regular expression, and set find what=“([^”]*)" and replace with=$1. (edit: to clarify, the quote marks around the parenthesis are part of the search-string, so you should type those, too)

  • Regex to delete sections of XML

    8
    0 Votes
    8 Posts
    4k Views
    Christopher PhillipsC

    @guy038 said:

    Thanks @guy038 you are a star. I misread and thought everything needed to be on a single line. You new regex works perfectly.

  • Encoding

    5
    0 Votes
    5 Posts
    2k Views
    andrecool-68A

    Sometimes instead of UTF-8 it defines windows-1258

  • How to interpret the coding of macros?

    3
    0 Votes
    3 Posts
    3k Views
    GezaShadG

    Alan, Thank You for your answer!

  • Delete all rows of a text file except company names

    Locked
    6
    0 Votes
    6 Posts
    2k Views
    Raymond Lee FellersR

    Thanks to everyone who helped with this question. Each answer contributed to the solution. Special thanks to guy038 who gave me a better understanding of how the code works and his solution worked perfectly.

    Ray Fellers

  • cree un forum

    Locked
    1
    0 Votes
    1 Posts
    386 Views
    No one has replied
  • Disable document switching when mouse4 is pressed

    Locked
    9
    1 Votes
    9 Posts
    2k Views
    Mikhail VM

    @trace-calvin
    XButton1 - 4th mouse button. Typically performs the same function as Browser_Back.
    XButton2 - 5th mouse button. Typically performs the same function as Browser_Forward.

    So NPP cycles back through tabs on both Browser_back event and Xbutton1 event. I didn’t find any option to disable or change it. If it bothers, you can use Autohotkey script to change this button, or block completely with this script:

    #If winActive("ahk_exe notepad++.exe") XButton1::return
  • Search result window

    Locked
    6
    0 Votes
    6 Posts
    1k Views
    guy038G

    Hello, @олег-выползов,

    Just one question :

    When you just mouse select this string $c_word, in current file, do you see, in the status bar, at the bottom of N++ window, the indication Sel 7|1 ?

    If you get a value above 7, this would mean that the string $c_word, itself, contains one or several invisible chars !

    Best Regards,

    guy038

  • Encodage

    10
    0 Votes
    10 Posts
    5k Views
    Meta ChuhM

    @guy038

    there’s more than that broken with the current auto detection !
    same vietnamese detection happens if you save the word “Réservation” to a new utf-8 file and reopen,

    so only the combination of ï and é in the same document is detected correctly, é only will detect it as vietnamese

    this did not happen prior to this commit that @Eko-palypse mentioned.

    You may, also, convert your file to the UTF-8-BOM encoding

    this is not possible in many cases, because those files like in this case are in an open source repository.

    same with spanish, exept if i have an ñ in my documents, so i didn’t notice it before, as most of them have an ñ.
    german characters work ok so far.