• Need help in replace and delete all similar sentence

    4
    0 Votes
    4 Posts
    543 Views
    guy038G

    Hello @tommy-tan, @lycan-thrope, @mark-olson and All,

    Given the INPUT text, below

    SM1+VRDP4-OOCU4868933:20240906151200:;;::KOJ’ SM1+VRDP4 OOCU7704147:20240905132700:;;::KOJ’ SM1+VRDP4-CBHU4477056:20240906141100:;;::KOJ’ DEF456SM1+VRDP4-CBHU4477056:20240906141100:;;::KOJ’ AB9+VRDP4-CBHU4477056:20240906141100:;;::KOJ’

    A more simple formulation would be to use one of the three regexes, below :

    (?-is)VRDP4.+?(?=:) which matches any string beginning by an uppercase string VRDP4 till the very first colon of the current line

    (?-is)(?<=^SM1\+)VRDP4.+?(?=:) if, in addition, the uppercase string VRDP4 is preceded by an uppercase string SM1+, strictely beginning a line

    (?-is)(?<=SM1\+)VRDP4.+?(?=:) if, in addition, the uppercase string VRDP4 is just preceded by an uppercase string SM1+

    Now , if we consider the general example below :

    ABC XYZ 123ABC XYZ ABCXYZ 123ABCXYZ

    As said above :

    The regex (?-i)(?<=^ABC)XYZ would find any uppercase string XYZ if predeced by an uppercase string ABC strictely beginning a line

    The regex (?-i)(?<=ABC)XYZ would find any uppercase string XYZ, if preceded by an uppercase string ABC

    However the two regexes (?-i)^(?<=ABC)XYZ or (?-i)(?<=ABC)^XYZ cannot find any match ! Why ? Just because the ^ is a regex assertion which is a shorthand of the (?<=\n|\r) syntax. Thus, these two syntaxes can be replaced by (?-i)(?<=\n|\r)(?<=ABC)XYZ and (?-i)(?<=ABC)(?<=\n|\r)XYZ. And it obvious that the string XYZ CANNOT be preceded, at the same time, with both an EOL character and the string ABC !

    For people who want to know the right syntaxes, in this specific case, they are (?s-i)^(?<=ABC..)XYZ and (?s-i)(?<=ABC..)^XYZ, where the two dots represent an EOL char ! So, they both match an uppercase string XYZ, right after an uppercase string ABC\r\n

    Note that the third syntax (?s-i)(?<=ABC..)XYZ, without any ^ symbol, matches also the two uppercase strings XYZ, beginning a line

    Actually, to be exhaustive, the later regex (?s-i)(?<=ABC..)XYZ matches any uppercase string XYZ, preceded by a fixed string of 5 characters :

    The first three are the uppercase string ABC

    The following two chars can be absolutely any char ( standard or EOL characters )

    Best Regards,

    guy038

  • 1 Votes
    29 Posts
    5k Views
    PeterJonesP

    @Manfred-Drechsel said in Highlighting with self created words in "langs.xml" does not work:

    Only a minor issue which I’ve seen is the width of the style selection list control. It should be wider to see the full text of the styles. See attachment. Guess I directly should file an issue for NPP?

    It’s always been that way (see for example, the “INSTRUCTION WORD” on ActionScript, or the “Indent guideline style” in Global Styles, both of which have gone beyond the width for multiple versions of N++).

    If you want that aspect of the GUI changed, you would need to put in a feature request in N++'s GitHub repo. I would suggest asking for either resizable, or wider-by-default, or at least having a hover (or having a hover plus resizable/wider).

    I am highly doubtful that the Developer would implement be wider-by-default; there’s slightly more chance that he’d make it user-resizable; I would say the best-chance for implementation is using the full Style name as the hover text for each entry, which is why I suggested it, but no guarantees it would be implemented.

  • How to play Audio MP3 files saved on laptop in notepad plus plus

    6
    0 Votes
    6 Posts
    1k Views
    Lycan ThropeL

    @guy038 said in How to play Audio MP3 files saved on laptop in notepad plus plus:

    file:///D:\MyMusic\Rolling%20Stones\YouCantAlwaysGetWhatYouWant.mp3

    Guess I learn something everyday. I never double click links…so never thought that NPP did that launch. Oh well, I stand corrected. :-)

  • Search accent-insensitive

    5
    0 Votes
    5 Posts
    868 Views
    PeterJonesP

    @VERSEAU44 said in Search accent-insensitive:

    Why have I this result (white rectangles) when I copy/paste tables in my NotePad++ ?

    Because your font (Notepad++ menu Settings > Style Configurator > Language: Global Styles > Style: Default Style > Font name) doesn’t include glyphs for those characters. You might be able to toggle Settings > Preferences > MISC > ☐ Use Direct Write and restart Notepad++, and it might help the OS grab glyphs from other fonts to use in Notepad++ when your active font doesn’t have a specific glyph.

  • INI files opening in wrong language (Temporary fix found)

    2
    0 Votes
    2 Posts
    433 Views
    PeterJonesP

    @Red-Green ,

    when I take a portable v8.6.9 (which just has the default extensions from langs.xml, with no changes in the Style Configurator user-ext) and open an ini file, it appropriately identifies it as an INI.

    0ea277b6-4e19-4f07-bb1f-576d151e3dc7-image.png

    Can you use the </> button in your reply and paste in a short .ini file which consistently is mis-identified, so we can try to reproduce the problem? Because right now, “it works for me”.

  • Is Visual Basic dependent on .NET?

    3
    0 Votes
    3 Posts
    439 Views
    Ann OnymousA

    @PeterJones I only asked since I saw it as an option in Language and I’d rather use N++ than VSC. Sorry for the confusion.

  • Facebook login broken

    2
  • Style token not saved

    30
    0 Votes
    30 Posts
    14k Views
    SalepS

    @PeterJones thank u sir I got it

  • Notepad ++ connecting to browsers from program

    3
    0 Votes
    3 Posts
    315 Views
    Mark OlsonM

    You could also right-click on the tab for a file and select Open in Default Viewer from the drop-down menu that appears. If, for example, your default viewer for a .html document was Firefox, that would open that file in Firefox.

    I have no idea which NPP version that option was first introduced in.

  • alphabetic order

    4
    1 Votes
    4 Posts
    352 Views
    pouemes 0P

    thanks Alan and Coises will see the plugin

  • A simple search and replace

    8
    0 Votes
    8 Posts
    506 Views
    Mark OlsonM

    @guy038 said in A simple search and replace:

    To my mind, all these statements can be solved with the two following regexes :

    Regex A : (?-s)"(?:\\.|.)+" Regex B : (?-s)"(?:\\.|.)+?"

    I would use Regex B with a slight modification; the +? should be a *? to correctly handle the empty string "".

    Thus, I think the simplest regex we can use for this task is probably (?-s)"(?:\\.|.)*?"

    There is one important caveat here: these regexes for recognizing JSON strings will break if you start the search in the middle of a string.

    For example, if you have this text

    "foo" "bar" "from\r\n\t[\"\\\"here\\\"\", \"to\", \"here\" is all one string]"

    the best regex, (?-s)"(?:\\.|.)*?", will correctly identify exactly three strings in the file if you start the search at the beginning of the file.

    But if you start with the caret after the word from on the second line, you will incorrectly identify "\\\"here\\\"\", \"to\", \"here\" is all one string]" as being a valid string.

  • Hotkey for Search Results > Copy Selected Line

    3
    1 Votes
    3 Posts
    421 Views
    Artur HarisonA

    @PeterJones
    I thought it would be in the release.
    Since the status on GitHub is implemented.
    Sorry!

  • How to (auto) format text to start at column 25, 85 and 115

    10
    0 Votes
    10 Posts
    2k Views
    Alan KilbornA

    Another editing technique that might help; say you have this:

    218c1177-23de-4b20-b9a1-2db2b1d6c785-image.png

    Clearly all of the data in the second column needs to be lined up.

    If you create a column caret using Shift+Alt+arrows and make it look like this:

    93212e91-ccf9-4b6f-8a93-0d3cbaf7aaf7-image.png

    and then press Ctrl+Delete, you’ll get something looking like this:

    3f7b30e7-d6e8-427b-9c70-bb66c644d59a-image.png

    It’s then a simple matter to press space-bar a few times to get all of the data aligned, and in the correct column:

    289e96d7-55b3-4b4a-a488-285d26cd325a-image.png

    Note that in the create-column-caret step, the column caret does NOT touch any of the text to be aligned, there is one or more intervening space(s) (this is a very important point).

  • Notepad data deleted after clicking "Yes" to prompt

    5
    0 Votes
    5 Posts
    669 Views
    Alan KilbornA

    @githubtools101 said:

    there is a way to TURN OFF that unnecessary prompt for the future:
    Under “File Status Auto-Detection” click Disable from the drop-down menu
    Now, you will NEVER be given this prompt again!
    I don’t understand why Notepad++ has this feature to begin with

    So @githubtools101 had a problem with data loss, and your solution is to give him a method that can guarantee future data loss? Nice job…

  • To align single line content to multiple lines

    2
    0 Votes
    2 Posts
    224 Views
    CoisesC

    @Lakshman-Prasath-Š said in To align single line content to multiple lines:

    Try this:

    From the main menu, choose Search | Replace….

    In the dialog, enter:
    Find what: Updated
    Replace with: Updated\r\n
    Wrap around checked
    Search mode: Extended
    then click Replace All.

  • Combine 2 searches

    6
    0 Votes
    6 Posts
    519 Views
    HaPe KrummenH

    @Mark-Olson @PeterJones

    thank you for your help. ChatGPT wrote me a routine that worked with a dozen files on my directory testfiles … now I copy all files to a directory to test it tonight with 25000 files

    I’m really surprised how easy this can be.

    And I’m reading the code to understand, what the script is doing as I apreciate any help but want to learn :-)

  • How to group lines with same beginning

    12
    0 Votes
    12 Posts
    2k Views
    Mark OlsonM

    @Alan-Kilborn said in How to group lines with same beginning:

    Python’s re uses a different engine than Notepad++ does. While this can be a “good thing”, sometimes it will trip a user up – they’ll get a “tricky” regular expression working in Notepad++, and then run into trouble when trying to automate using the same expression in a script.

    This does in fact happen in multiple places in my script. I’ll just break down how the regular expressions I used had to change to be compatible with Python’s re engine.

    STEP 1 REGEX CHANGES

    (?-s)^([^\$\r\n]*)(.*\R)(?:\1(.*)(?:\R|\z))*
    becomes
    (?m)^([^$\r\n]*)([^\r\n]*(?:\r?\n|\r))((?:\1(?:[^\r\n]*)(?:\r?\n|\r)?)*)

    (?-s) is unnecessary (because . already does not match newline by default in re) (?m) is necessary to make it so that ^ matches at the beginning of the file and at the beginning of lines. In Notepad++ regex, ^ matches the beginning of lines by default. Every instance of . must become [^\r\n] because in Python . matches \r, which is bad because that is the first character of the \r\n sequence that indicates a newline in Windows. Every instance of \R (shorthand for any newline) must become (?:\r?\n|\r), which matches the three most common newlines (\n, \r\n, and \r)

    The Step 2 regex also needs to be changed from (?-s)(\R?)(\x07)?([^\$]*)(\$+)(.*) to ((?:\r?\n|\r)?)(\x07)?([^$\r\n]*)(\$+)([^\r\n]*) because of point 3 above (the lack of \R in Python’s re)

    Finally, I had to create callback functions (the def replacer1(m): and def replacer2(m)) above, because the replacement regexes I used in Notepad++ don’t work in Python.

  • search / replace /delete parts of URL on several hundred pages

    9
    2 Votes
    9 Posts
    1k Views
    HaPe KrummenH

    Just wanted to say THANK YOU for your help!

    Beeing able to use regular expressions changes a lot and makes searching / replacing and deleting of texts so much easier.

    Have a good day!

  • Opening files in Macintosh and i need in windows

    4
    0 Votes
    4 Posts
    8k Views
    John RinconJ

    @Scott-Sumner . Thanks Scott.

    September 2024 and this message is still very helpful. I had the same problem loading a file that usually loads without problems.

    This time, the problem was the one related with your diagnosis. The line terminators CRLF in the end of line of the records.

    Thanks for help the community.

  • Run C++ without compiling

    7
    0 Votes
    7 Posts
    1k Views
    rdipardoR

    The directory will change automatically after clicking on NppExec’s “Follow $(CURRENT_DIRECTORY)” option (which I thought was enabled by default – sorry):

    Screenshot 2024-09-10 121533.png