Community
    • Login
    1. Home
    2. Popular
    Log in to post
    • All Time
    • Day
    • Week
    • Month
    • All Topics
    • New Topics
    • Watched Topics
    • Unreplied Topics
    • All categories
    • J

      search-and-replace NOOB question - CR and (any number)

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      3
      0 Votes
      3 Posts
      43 Views
      PeterJonesP

      @JEFerris-99999 said in search-and-replace NOOB question - CR and (any number):

      Note - I know it needs to be Extended Search Mode.

      This is the first part of the problem. If you want to match “any number”, then Extended Search Mode isn’t sufficient: you need to use Regular Expression mode, not Extended Search Mode.

      = (carriage return or line feed)(any number)(any number)(colon)(any number)(any number)(carriage return or line feed)
      and Replace:
      = (space)
      should be really simple, but the online User Manual - well, I have not been able to find any descriptors that fit, nor any examples close to my needs.

      Searching > Regular Expression > Character Escape Sequences: \d matches any digit (0-9), which is what I am interpreting your “any number” to mean Searching > Regular Expression > Special Control Escapes: \R matches a newline sequence in a FIND WHAT, whether you are in Windows (CRLF), Unix/Linux (LF), or ancient Mac (CR) line-ending mode; it will match the whole newline sequence, not just one byte from it, to make sure that your replacement works as you expect it to. (In practice, it essentially matches \r\n|\r|\n, though technically it matches (?>\r\n|\n|\x0B|\f|\r|\x85|\x{2028}|\x{2029}) )

      I am assuming that the = you show was you saying “my expression equals…” rather than meaning a literal = sign before the newline. If so, then FIND WHAT = \R\d\d:\d\d\R would match carriage return or line feed, any digit, any digit, colon, any digit, any digit, carriage return or line feed .

      For the replacement, just type the space character (or, if you want to be fancy, use \x20 to reference ASCII hex20 = decimal32 = space character)

      Putting it all together:

      FIND WHAT = \R\d\d:\d\d\R REPLACE WITH = \x20 (or just a space, but I cannot show a space character in the red text SEARCH MODE = Regular Expression

      Unfortunately, nothing I have tried works as I desired, and I’m not sure why. Could you please help me understand what went wrong and help me find the solution?

      “Extended” is the wrong mode to be able to do generic digits rather than just specific numbers If you just matched the LF of the CRLF sequence, and replaced that with a space, then you would still keep the CR, which Notepad++ would still display as a newline. Turning on View > Show Symbol > Show End of Line and Show Space and Tab would help you see exactly what’s happening with the end of line characters and spaces/tabs, where a carriage return \r shows up as CR in a black box, line feed \n as LF in a black box, and the space will be a mid-dot and the tab a right-arrow.
    • Fred MorantF

      using User Defined Language : v.2.1.0.12

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      2
      0 Votes
      2 Posts
      25 Views
      PeterJonesP

      @Fred-Morant ,

      1/ notepad kraches

      The UDL engine itself has not changed (it’s been at 2.1.0.12 for years). But in Notepad++ v8.9.2, they changed the library that reads the XML definition file(s), and there was a bug which causes Notepad++ to crash when you enter a keyword that’s too long (or sometimes even when you load the XML from disk). That bug has been fixed in v8.9.3, which is currently available as a “Release Candidate”, as linked from here. If you don’t want to use a Release Candidate, then you can install the older v8.9.1 until v8.9.3 is fully released.

      2/ other “strange thing” : when you have use let say “NewName” as a name for an user defined language, that name is definitively unusable : it appears nowhere in the roaming : C:\Users\me\AppData\Roaming\Notepad++ ,

      When you create any new UDL using the GUI, it saves them all into ...\AppData\Roaming\Notepad++\userDefineLang.xml, instead of creating a separate file for each UDL. There’s a section in the Online User Manual on Keeping UDL Files Separate

      And it doesn’t save it into userDefineLang.xml until you exit Notepad++. Closing the User Defined Language window in the GUI does not save it to disk.

      (When I was experimenting with the v8.9.2 crash, I also found that it wasn’t necessarily storing the name of the new UDL properly in the GUI interface, which may have been adding to your confusion. Again, either go to v8.9.3-ReleaseCandidate, or go back to the released v8.9.1 if you want UDL to behave as expected.)

      if i force rebuilt of config.xml by setting it at configold.xml

      then NewName appears in userDefineLang.xml

      UDLs have nothing to do with config.xml, and doing that had no influence on what happened. It just got saved to that file when you exited Notepad++, even before you renamed config.xml.

    • dfs-D

      Dark Mode style for UDL

      Watching Ignoring Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
      2
      0 Votes
      2 Posts
      29 Views
      PeterJonesP

      @dfs said in Dark Mode style for UDL:

      I wondered if it is possible to modify the style for the dark mode the same way it works for the included languages

      You define two separate UDL (two separate files), one with your light colors, one with your dark colors. Then, as is done in markdown._preinstalled_DM.udl.xml (which comes preinstalled when you get N++), you set darkModeTheme="yes":

      <UserLang name="Markdown (preinstalled dark mode)" ext="md markdown" darkModeTheme="yes" udlVersion="2.1">

      (yours would, of course, have the name and extensions appropriate for your UDL)

      When you have both those UDL in Notepad++, then when it’s in Dark Mode, it will use the settings from the UDL with darkModeTheme="yes", and when in Light Mode, it will use the settings from the UDL without that attribute (or with that attribute set to "no", IIRC).

    • Freon SandozF

      Unexpected match when searching files for an end-quote character (non-ASCII)

      Watching Ignoring Scheduled Pinned Locked Moved General Discussion
      2
      0 Votes
      2 Posts
      50 Views
      CoisesC

      @Freon-Sandoz said in Unexpected match when searching files for an end-quote character (non-ASCII):

      The text is from a Perl script I wrote long ago. Notepad++ identifies the file as “ANSI” and it appears to be encoded as Windows-1254, although Notepad++ doesn’t identify it as such.

      When Notepad++ opens a file as ANSI, it is using the default code page for your system. Is the default code page for your system Windows-1254? (One way to tell would be to copy the Debug Info… from the ? menu. Among other useful diagnostic information, it lists the Current ANSI codepage.)

      If your code page is not 1254, then try opening the file in Notepad++ and immediately — before you do anything else! — select Encoding | Character sets | Turkish | Windows-1254. That will cause Notepad++ to reload the file and interpret it using the specified code page.

      I’m not convinced that is the problem, though. In the screen shot you included, the quotes look like straight quotes, not typographic quotes. You’ve highlighted the quote mark, but that appears to be just your selection, not the result of a search; I think the search you show in that screen shot will not (and should not) match.

      So I think it’s more likely that the problem lies in whatever led you to think that there is a non-ASCII end quote in the file. You say you didn’t expect a curly quote and it looks like you don’t have one. What sort of file search did you do that led you to think there was one?

    • Robk BlueR

      Tidy2 or other HTM L plugins

      Watching Ignoring Scheduled Pinned Locked Moved General Discussion
      2
      0 Votes
      2 Posts
      91 Views
      PeterJonesP

      @Robk-Blue said in Tidy2 or other HTM L plugins:

      It looks like Tidy2 is a 32 bit plugin and I can’t find a x64 version. Is it able to be used still? Any other options?

      Yeah, Tidy2 hasn’t been updated in more than a decade – it’s essentially abandoned. And as far as I can tell, no one here has grabbed the source code, recompiled for 64-bit, and published it anywhere (that has happened on some other plugins that used to be only 32-bit, if someone here was interested enough in that plugin to do it for themselves and share it with others)

      XML Tools is able to make XML look pretty, and usually works on HTML files as well.

      Other than that, it’s possible to pass the current file to your favorite external command-line code-prettifier (tidy.exe, if you installed HTML Tidy utility on your computer yourself), using either the Run > Run to create a User-defined command, or using a plugin like Pork2Sausage or NppExec.

      See also the FAQ: How do I use Notepad++ to Compile my Source Code (or Convert My Text)?, which has a section on Converting text (which is what things like tidy.exe are doing), and explains how to use the plugins mentioned in the previous paragraph to accomplish conversion tasks.

    • donhoD

      Notepad++ v8.9.3 Release Candidate

      Watching Ignoring Scheduled Pinned Locked Moved Announcements
      12
      5 Votes
      12 Posts
      733 Views
      donhoD

      New RC4, in which the cURL security issue in WinGUp is fixed & model capacity of shortcuts.xml & contexMenu.xml for administration. is added, is available:
      https://github.com/donho/notepad-plus-plus/releases/tag/RC4