• Link on Html page

    2
    0 Votes
    2 Posts
    209 Views
    PeterJonesP

    @FANT-OME ,

    I would like to insert a link which, when I click on it, takes me to a sentence on my page

    If you mean, “I want to insert in my HTML source code a link which, when I click on it while viewing the file in my browser, takes me to a sentence on my page in the browser”, that’s an HTML question, and off-topic here (but I will give you the hint to search the web for documentation on how to create HTML anchors 🛈 and how to link to anchors 🛈 – that’s pretty basic HTML technology, and quite well documented)

    If you mean, "I want to insert a link which, when I click on it inside the Notepad++ editor window, takes me to a sentence on my page inside the Notepad++ editor window so that I can edit there, then I’m sorry to say, there is no built-in way of doing that. There are things you can do in a plugin (either purpose-written, or one of the generic scripting plugins like PythonScript). If you choose to go down that route, but need some pointers in the right direction, you can show what you’ve tried and we can give you some help.

  • NOTEPAD++ TEXT STAYS THE SAME WHEN VIEWED IN BROWSER

    4
    0 Votes
    4 Posts
    3k Views
    Newbie104N

    Thank you for insight guys! I guess I’ll be paying attention to what type of file I am saving Ha ha ha. Cheers!

  • Basic Language and Folding Questions

    12
    0 Votes
    12 Posts
    1k Views
    David LinD

    @PeterJones said in Basic Language and Folding Questions:

    @David-Lin said in Basic Language and Folding Questions:

    maybe indent-based code folding as an option could help

    I know the Python language lexer uses indent-based folding. But once again, that’s not transferrable to any other arbitrary lexer, and the UDL does not implement indent-based folding.

    Especially since, from my perspective, nesting /folding of code across all languages isn’t a property unique to a language the way keywords and specific functions are.

    From my perspective, it very much is language dependent. In Python, indenting is the only way of indicating blocks; in Perl, indentation only matters for the human reader, and blocks are defined by {}. In other languages, there are keywords like BEGIN/END or FOR/NEXT or IF/ELSE IF/ELSE/ENDIF which will define levels. Each lexer only codes in the level-determining code necessary for its language, because each lexer is completely separate. (And, once again, that’s not something that’s likely to change in Notepad++, because Notepad++ just passes along the lexers that were released with Scintilla.)

    Got it. thanks for the explanation - now i understand why my use case in SQL is different than the intent of the built-in code folding. For me, there are not generally large blocks of code between “level-determining code necessary for its language”, because in my use for preparing data tables, there is little purpose to long nested statements or loops, just moving around and rearranging data for other programs to eventually access and do analysis looping etc… occasionally there is a very long nested query. Procedures that might involve longer segments of code within loops are quite painful in SQL.

    For my use, I am separating large sections of code into my subjective segments that I would like to see nested, but these are not exactly “necessary” for the language.

  • remove string after a limiter

    6
    0 Votes
    6 Posts
    580 Views
    Alan KilbornA

    @guy038 said in remove string after a limiter:

    Alan beat me too. Moreover, with exactly the same regex :-)

    Haha, well does this show that some of us are learning?
    See, it can happen, people!

  • question about saving themes

    7
    0 Votes
    7 Posts
    562 Views
    PeterJonesP

    @mere-human , @Alan-Kilborn

    I believe what I had seen was pull #9339 commit 52e8c68 … though it looks like it’s not working yet.

    AFAIK, that is separate from wingup commit 9b193fa.

  • Need to compile VHDL file using external ModelSim

    4
    0 Votes
    4 Posts
    995 Views
    PeterJonesP

    It’s been asked enough times; I created a FAQ Desk entry for this topic.

  • How many files are opened (show number)

    12
    0 Votes
    12 Posts
    4k Views
    astrosofistaA

    Hi @M-FR

    For different reasons as yours, I found this information useful to my working setup, so and though I am not a real programmer, managed anyway to write — based on countless examples buried in the forum archives — this little Python script, tested in npp7.9.1.portable.x64, which will show how many files are opened in the status bar.

    If there is any issue with it, lets hope that the Pythoniers of the forum chime in.

    from Npp import * def StatusbarFilesAddition(args): Cur_Lang = notepad.getLanguageDesc(notepad.getLangType()) Open_Files = 0 for file in notepad.getFiles(): Open_Files += 1 notepad.setStatusBar(STATUSBARSECTION.DOCTYPE, '{} - Open files: {}'.format(Cur_Lang, Open_Files)) editor.callback(StatusbarFilesAddition, [SCINTILLANOTIFICATION.UPDATEUI]) # register callback

    If you want to try the script, here are some instructions to install it:

    First off, install PythonScript using Plugins > Plugins Admin.

    Then go to Plugins > Python Script > Scripts, Ctrl+Click on startup, and paste the script at the bottom of the file. Save and close startup.

    Now go to Plugins > Python Script > Configuration…, and change the “Initialisation” setting from LAZY to ATSTARTUP. Exit Notepad++ and reload.

    From now on the first section of the status bar will show how many files are opened in Notepad++ after the current language.

    Take care and have fun!

  • Regex replacement not working

    2
    0 Votes
    2 Posts
    440 Views
    PeterJonesP

    @Paul-Moloney said in Regex replacement not working:

    Any help on the valid syntax for Notepad++ appreciated (what flavour of regex does it use?

    The docs explain Notepad++ uses the Boost regular expression library (v1.70).

    But in every regex version I’ve used, [A-Za-z0-9-_\.%] would cause problems; in general, hyphens mean “range” inside a character class, unless they are escaped or the last character in the class. So [0-9-] is okay, [0-9-_] is not, but [0-9_-] is (non-range hyphen last) and [0-9\-_] is.

  • Replace characters only when a certain number exist

    11
    0 Votes
    11 Posts
    1k Views
    Jim MillerJ

    @guy038
    I tried to run it on another machine and it executed successfully. I suppose I should have tried the first ;-)
    Anyway, thank you very much for your help

  • [UDL] Code fold get incrementally out of alignment.

    6
    0 Votes
    6 Posts
    4k Views
    Michael NooneM

    Replying to this as this showed up in Google - I know this is very old, but this solved my problem where when I added a comment block, it then the folding was not aligned with the foldable elements.

  • Getting AppCrash

    Locked
    2
    0 Votes
    2 Posts
    330 Views
    PeterJonesP

    @Richard-Woods-Jr ,

    see “FAQ Desk: Request for Help without sufficient information to help you” and then reply here with more detail.

    If this is the same issue as your other post, please only ask it in one place; choose whether you think it’s generic help with Notepad++ (this post), or a problem with you developing a plugin (the other post), and only reply in one of the two topics.

  • Кодировка из UTF-8 в ISO 8859-1

    4
    0 Votes
    4 Posts
    2k Views
    PeterJonesP

    @Michael-Khmelnitskiy ,

    When the Settings > Preferences > MISC auto-detect is turned off as @litos81 suggested, that means it is not going to try to auto-detect. When that preference is off, you will likely need to manually change the encoding to ISO 8859-1.

    The problem is that Windows does not store the encoding information as metadata in the directory entry, nor as metadata attached directly to the file. Because of this, Notepad++ has a mode where it tries to guess what the encoding is, based on the sequence of bytes found in the file – but that mode guesses wrong, because all bytes just look like bytes and the guessing-algorithm cannot be perfect. When you turn off that guessing mode, then Notepad++ no longer guesses.

    Further, if your ISO 8859-1 document doesn’t have any characters that aren’t in the 7bit ASCII range, then it doesn’t matter whether Notepad++ says your document is ISO 8859-1 or UTF-8 – the bytes on disk will be the same.

    If you do have characters above 127 in your document, then you can just choose that 8859-1 character set for the encoding. To make it easier, you can go to Settings > Shortcut Mapper, and type 8859-1 in the Filter box, then Modify the shortcut for that to some unused keyboard shortcut that you will remember means “make this file 8859-1”.

    ------

    Когда “Настройки” > “Предпочтения” > “Автоопределение MISC” отключены, как было предложено в @litos81, это означает, что not будет пытаться выполнить автоопределение. Когда эта настройка выключена, вам, скорее всего, придется вручную изменить кодировку на ISO 8859-1.

    Проблема в том, что Windows не хранит информацию о кодировке в виде метаданных в записи каталога, а также в виде метаданных, прикрепленных непосредственно к файлу. Поэтому в Блокноте++ есть режим, в котором он пытается угадать, что такое кодировка, основываясь на последовательности найденных в файле байт – но этот режим угадывает неправильно, потому что все байты просто выглядят как байты, а алгоритм угадывания не может быть совершенным. Когда вы отключите этот режим угадывания, Блокнот++ больше не будет угадывать.

    Далее, если в вашем документе ISO 8859-1 нет символов, которые не находятся в 7-ми битном диапазоне ASCII, то не имеет значения, говорит ли Блокнот++ о том, что ваш документ ISO 8859-1 или UTF-8 - байты на диске будут теми же самыми.

    Если у вас do в вашем документе есть символы выше 127, то вы можете просто выбрать этот набор символов 8859-1 для кодировки. Чтобы сделать это проще, вы можете зайти в Settings > Shortcut Mapper, и набрать 8859-1 в поле Filter, затем Modify ярлык для этого на какой-нибудь неиспользуемый ярлык клавиатуры, который вы запомните, означает “сделать этот файл 8859-1”.

    Переведено с помощью www.DeepL.com/Translator (бесплатная версия)

  • Add Increment Number End Of Word

    3
    0 Votes
    3 Posts
    602 Views
    Terry RT

    @Terry-R said in Add Increment Number End Of Word:

    although I do believe there are various snippets of code already supplied in this forum, that if one looked for them they could be easily adapted to solve this.

    It turned out that such a question has already been answered and I was involved in an alternate solution using only regex (not recommended as much massaging of the data). Have a look at:
    https://community.notepad-plus-plus.org/topic/20462/how-to-append-the-numbers-with-specific-string
    See if it helps in any way.

    Cheers
    Terry

  • Synchronize lines in cloned window?

    2
    0 Votes
    2 Posts
    469 Views
    Terry RT

    @Igor-Itkin said in Synchronize lines in cloned window?:

    synchronize lines in a cloned window with word wrap?

    AFAIK no. Actually although you mention “cloned window” your image suggests otherwise. A clone is an exact replica of the original, clearly you have 2 different files open, 1 in each view. So you are just viewing 2 files, one in the “main” view, the other in the “other view”.

    I presume you are aware of the “synchronize vertical scrolling” as appears under the “View” menu. Note it mentions vertical scrolling, not lines, which is in essence what you want. So with word wrap on of course the “real” lines will quickly get out of synch. And as you mention word wrap, you probably already know the “synchronize vertical scrolling” will work if word wrap is off in both views.

    As a suggestion, if you have a need to keep the “lines” together for purposes of editing or such like, then maybe consider having the 2 files merged. You can opt to put even line numbers at the start of every line for file #1, and odd numbers for file #2. Then merge and sort by line numbers. At the end if you are primarily just wanting the content of 1 file, then by using a “a” and “b” appended to the line numbers you could easily remove the 'a" or “b” lines. Alternatively a regex could grab both lines (in pairs), then just return the first or second line, achieving the same result.

    Terry

  • mass replace diffrent text in file

    8
    0 Votes
    8 Posts
    567 Views
    Clyde ParkerC

    thanks everyone for your help, i’ve got how to make this work

  • Select all exclamation marks ! from a specific html tag

    15
    0 Votes
    15 Posts
    2k Views
    Alan KilbornA

    @guy038 said in Select all exclamation marks ! from a specific html tag:

    So the generic regexes, of my previous post, should be improved as :
    SEARCH (?s)(?:BR|(?!\A)\G)(?:(?!ER).)?\K(?:SR)    OR    (?-s)(?:BR|(?!\A)\G)(?:(?!ER).)?\K(?:SR)

    So, Guy, just a note again to say thanks for this.
    I have employed it 3 or 4 times in the last week, and I anticipate much more usage in the future.
    Very handy!

    One good example is in a section of a log file I have to process repeatedly.
    The section starts with certain line contents and ends with certain other line contents (thus BR and ER).
    Inside this section there are subsection headers (that have a consistent pattern to their format), and also “WARNING”, “ERROR”, “FAILED” , etc. text that follow the subsection headers (identifying problems within that subsection).
    By combining the headers and the error text bits in an OR’d together regex (to form the SR),I can create some nice output (in the Search result window) that identifies clearly the subsections that have “problems” and those that are “clean”.

    So very nice.

  • 2 Votes
    5 Posts
    334 Views
    guy038G

    Hello @snmnarum,

    Possessing some administrative rights, I took the liberty to modify your last link, to Github, which was wrong, because of a missing slash /, in front of the issue number 9478

    INITIAL link : https://github.com/notepad-plus-plus/notepad-plus-plus/issues9478 MODIFIED link : https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9478

    Best Regards,

    guy038

  • Replacing a digit with exception

    21
    0 Votes
    21 Posts
    2k Views
    guy038G

    Hello, @jean-francois-trehard and All,

    In wanting to explain, my regex S/R, provided in my previous post, I realized that we should add an hypothesis :

    You must move the caret to a blank line, located before the text to be processed by the S/R

    So, let’s start with the last version :

    SEARCH (?:\$|\G)\w*?\K(?:(0)|(1)|(2))

    REPLACE (?1G)(?2H)(?3I)

    Globally, the regex (?:\$|\G)\w*?\K(?:(0)|(1)|(2)), searches, from after a literal $ symbol OR after the end of the previous search, if any, for the smallest range, even empty, of words characters, till a 0, 1 or 2 digit, then only selects this last digit and replaces it, respectively, with the G, H or I letters

    Note that the \G assertion forces the regex engine to ask itself : does the current match attempt, immediately follows the previous match ? In case of a positive answer, the current match attempt is a possible match, so far !

    As this regex only looks for consecutive words chars, it’s easy to understand why the characters, located, in the second part of a line, after the # sign, are not concerned !

    Now, if you’re still in the fog, let’s go into a little more detail and start the search, for instance, with caret on an empty line, right before the first line dc.l $02220620 ; Tile #42

    Beware, everything below is a bit “off-putting” but, in any case, it happens like that if you break the process down into smaller basic actions !

    The regex engine first searches for a range of consecutive words characters till a 0, 1 or 2 digit, either, after a literal $ or after the end of the previous search. As no search has been performed, so far, \G syntax matches, by default, at current position, the beginning of the empty line, which is a zero-length string

    As no word char exists in that empty line, the regex engine skips the EOL chars and moves to the beginning of the next line dc.l $02220620 ; Tile #42. You could say : it should match the dc string, which are word chars, also ? No, no ! Because the initial location, in the empty line, and the dc location are not contiguous. Indeed, there is a gap of the two chars : \r and \n )

    Thus, the \G assertion is not true, presently. So the regex engine tries to match the first alternative and skips to the literal $ and the next 0 digit to search for

    The \K feature cancels any match, so far and resets the regex engine working position => So, it only matches this first 0 digit. Remember that this configuration is possible as the range of chars before digit 0, 1 or 2 to search for, may be empty

    As the group 1 is defined, when matching the 0 digit, the regex engine replaces it with the string G

    Now, as no more $ symbol exists, the regex engine needs to use the second alternative, the \G assertion, which represents the location right between the letter G and the next range of word chars till a 0, 1 or 2 digit. So it just matches the first 2 digit, right after and, again, only selects that digit 2

    As the group 3 is defined when matching the 2 digit, the regex engine replaces it with the string I

    The second, third and fourth 2 digit, of current line, as well as the second 0 digit, are matched, in the same way as above, and replaced, consequently, with the appropriate letter

    Then, the regex engine matches the 62 digit, right after the previous G letter, which verifies the \G assertion and selects only the fourth digit 2 of current line, due to the \K syntax

    Again, this 2 digit is replaced with a I letter, as group 3 is defined when matching the 2 digit

    The regex engine advances one position and matches the last 0 digit of current line and replaces it with the G letter

    Now, things become interesting : the regex engine must find a next range of consecutive word chars, possibly empty, ending with, either, a 0, 1 or 2 digit. Obviously, this next range of contiguous word chars is the string 42, located some chars after the end of our previous search ! So the \G assertion is not verified anymore and, as there is no other $ symbol, either, the overall search fails. Thus, the regex engine skips the remaining chars of that first line, after the third 0 digit, which has been changed into G and moves to the beginning of the second line where the process resumes !

    And, when a line just ends with a first range of word chars, without any comments zone, it, necessarily, will search for a literal $ symbol, as the \G feature cannot be true, due to the gap produced by the EOL characters of current line !

    As you may notice, the key point, in this kind of data, is that, the several ranges of words characters are not juxtaposed. So, the \G assertion forces, automatically, the process to cancel any further search after examination of each first range of consecutive words chars of each line, following a $ symbol ;-))

    Note also that, due to the \K syntax, inside this search regex, you cannot use a step by step replacement with several clicks on the Replace button. However, you can use the Find Next button, to get the different matches

    Wow ! Glad to see that you’re still there, after these long explanations ;-)) Thank you for your patience and full attention !

    Best Regards,

    guy038

  • RegEX - Find and rename special words (letter)

    8
    0 Votes
    8 Posts
    4k Views
    guy038G

    Hi @venus642,

    Sorry, I updated my search regex to :

    SEARCH (?-s)(\$|(?!\A)\G).*?\K(?<=\w)-

    Refer to my previous post that I updated too, for the hypotheses to respect and some other pieces of information !

    BR

    guy038

  • Syntax highlighting for non-administrator users

    6
    0 Votes
    6 Posts
    586 Views
    neualexN

    @PeterJones

    I granted UserX read/write permissions to the C:\Program Files\Notepad++ folder and syntax works now.

    Thanks for your help!