• Feature request: Modify Lines dialog for adding prefix/suffix to lines

    Locked
    6
    0 Votes
    6 Posts
    3k Views
    Scott SumnerS

    Here’s an example of a scripting-based solution, with Pythonscript.

    When you run the script, it walks you through your choices to get the job done:

    Step A:
    Imgur

    Step B:
    Imgur

    Step C:
    Imgur

    Here’s the short script, which I call PrefixOrSuffixLines.py:

    def POSL__main(): title = 'MODIFY LINES - Prefix or Suffix' result = notepad.messageBox( 'PREFIX {} lines (the alternative being to SUFFIX ) ?'.format('all' if editor.getSelectionEmpty() else 'selected'), title, MESSAGEBOXFLAGS.YESNOCANCEL ) if result == MESSAGEBOXFLAGS.RESULTYES: prefix_or_suffix = 'pre' elif result == MESSAGEBOXFLAGS.RESULTNO: prefix_or_suffix = 'suf' else: return result = notepad.messageBox( 'Apply {}fixing to EMPTY lines ?'.format(prefix_or_suffix), title, MESSAGEBOXFLAGS.YESNOCANCEL ) if result == MESSAGEBOXFLAGS.RESULTYES: do_empty_lines = True elif result == MESSAGEBOXFLAGS.RESULTNO: do_empty_lines = False else: return user_text = notepad.prompt( 'TEXT to {}fix all {}lines with:'.format(prefix_or_suffix, '' if do_empty_lines else 'non-empty '), title, '' # have input box start out empty ) if user_text == None: return editor.rereplace(r'(?-s)^(.' + ('*' if do_empty_lines else '+') + ')', lambda m: (user_text + m.group(1)) if prefix_or_suffix == 'pre' else (m.group(1) + user_text), 0, editor.positionFromLine(editor.getUserLineSelection()[0]), editor.positionFromLine(editor.getUserLineSelection()[1]) ) POSL__main()
  • Delete text with notepad ++

    Locked
    3
    -1 Votes
    3 Posts
    7k Views
    lolo germL

    very grateful to you, I’ve tried it and it works

  • My setting get lost when closing N++

    Locked
    1
    0 Votes
    1 Posts
    605 Views
    No one has replied
  • Feature request: Filter by shortcut too in the Shortcut Mapper

    Locked
    2
    2 Votes
    2 Posts
    832 Views
  • What happened to NPP's wiki page?

    5
    1 Votes
    5 Posts
    2k Views
    古旮

    Thanks for the reply. I’ve once been to Sublime’s forum, and I also find regex-related questions. So I think it is common to have regex questions for text editor forums. But here, NPP forum, is a perfect place for regex questions, especially the complicated ones, because of guy038.

    As for my case, my first post was about Regex syntax of “Replace with”, because I didn’t find it in the wiki page about regular expression. It was guy038 who showed me the right direction right away. After that, I learnt regex myself and I didn’t find it very difficult to cover 80% of all the syntax. If the wiki page had covered the essential information about Regex syntax of “Replace with”, I wouldn’t have posted that question. So I think essential wiki page information is very important.

    Some last words about learning regex. I didn’t used any of the regex sites. I just practiced on NPP, following the official regex documentation on BOOST. And it’s very good to know that there is a NPP version with less bug in regex, which is mentioned in the FAQ Desk.

    Actually, talking about regex questions is a little off-topic. I’m still curious about the technical status of the wiki page. I mean, can you devs log-in the wiki right now? Is the wiki page editable? Can you give or borrow me an account? Or maybe give an account to guy038 to let him organize the regex page. I also noticed that the Plugin Central is a little outdated. It’s unclear where to find the newest plugins.

    Things are getting a little messy, because being outdated. Where is the most recent official documentation of NPP? Is it gonna be in the FAQ catagory of this forum?

  • 1 Votes
    3 Posts
    1k Views
  • How to remove quotes on lines with notepad?

    Locked
    7
    0 Votes
    7 Posts
    5k Views
    jamie rolJ

    Thank you Mr. PeterJones

  • notepad++运行python 如何调用 cmder 或 git bash

    Locked
    5
    0 Votes
    5 Posts
    3k Views
    wzz xxW

    问题解决,感谢百度贴吧的 千城真人 吧友 ,
    其原始命令为 C:\downloads\cmder_mini\Cmder.exe /task {cmd::Cmder}&"C:\npMingw64\mingw\bin\python3.exe $(FULL_CURRENT_PATH) &echo "
    因为设置过环境变量, 精简为 cmder /task {cmd::Cmder}&"python $(FULL_CURRENT_PATH) " (后引号前空格不能省)

    详情见链接 https://tieba.baidu.com/p/5877576881

  • HOW TO ELIMINATE THE TEXT THAT IS REPEATED WITH NOTEPAD

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    ani rodetA

    thanks you very much

  • How to eliminate lines that meet a specific condition with Notepad?

    Locked
    6
    0 Votes
    6 Posts
    3k Views
    oscar remicccO

    @Scott-Sumner said:

    ^((:.+)|(.+:))(\R|\z)

    I appreciate your help friends

  • 0 Votes
    1 Posts
    696 Views
    No one has replied
  • 0 Votes
    1 Posts
    582 Views
    No one has replied
  • Replace Dialog Box

    5
    0 Votes
    5 Posts
    3k Views
    Scott SumnerS

    That behavior is relatively new. It appeared sometime between 7.2.2 and 7.4.2 – it is in 7.4.2. I’m not inclined to pin it down any closer than that. And maybe something from that time period is not entitled to be called “relatively new”. But it may help explain why it seemingly hasn’t been noticed before.

  • How to add numbers to a text with notepad?

    Locked
    8
    0 Votes
    8 Posts
    16k Views
    Scott SumnerS

    @guy038

    So we have 3 cursors, in front of each string

    We should note that to get multiple carets (aka cursors) you need Settings (menu) -> Preferences… -> Editing (box on left) -> Multi-Editing Settings -> Enable … ticked…which by default it is not.

  • Please kindly consider for indexing feature for search....PLEASE

    Locked
    2
    0 Votes
    2 Posts
    840 Views
    PeterJonesP

    This FAQ explains where to go for feature requests.

  • Replace certain text in lines with each line another file.

    Locked
    16
    1 Votes
    16 Posts
    9k Views
    Terry RT

    Apologies @guy038 and @scott-sumner, my post on “best” regex and “trying to outdo each other” was not meant seriously (;-D). And yes our primary goal here is to help the OP with their problem. I do still think though that we are trying to make our regex’s more efficient through this process. Does that equate to “best”, possibly in a roundabout way? And yes more efficient doesn’t necessarily mean faster, it may mean less complicated for the OP to understand and follow.

    And I welcome having others critique my regex, thanks @guy038, your “shortened” version of my regex was welcomed. I hadn’t spent a lot of time on the regex, I was mainly concerned with looking for a “more efficient”/“less complicated” solution.

    Thanks
    Terry :-))

  • How to use Notepad++ to view EDI documents

    Locked
    2
    0 Votes
    2 Posts
    16k Views
    PeterJonesP

    There is the View > Word Wrap toggle. With Word Wrap disabled, a long line will go off the right side of the screen, and not start a new line until EOL (CRLF, CR, or LF) is encountered. With it enabled, a line longer than your screen will wrap to the next line.

    Since I don’t know whether EDI documents are always newline-terminated for each “segment”, I don’t know if that’s sufficient for you. If not, you might want to embed a few lines (confidential info redacted), prefixing each line with four spaces, and surrounding your quote by a blank line on each end. With that example, you might be able to explain and/or show a screenshot as to what NPP is doing (screenshot > imgur.com > ![](https://url/to/image.png)), and explain what you’d actually like it to do.

  • Problem with syntax highlighting

    Locked
    3
    0 Votes
    3 Posts
    1k Views
    niente0N

    Hello, I updated Notepad++ to the latest version and it seems to work ok!!
    Thank you :-)

  • 0 Votes
    3 Posts
    2k Views
    Tamer YanniT

    Thanks Peter, I had a feeling this was the case but wanted to get an expert opinion. I wish there was a way to copy the builtin lexer to a UDL then make modifications to it.

  • How to extract text with a certain condition with notepad?

    Locked
    3
    0 Votes
    3 Posts
    5k Views
    ani rodetA

    @Scott-Sumner said:

    Bookmark

    thanks you Scott Sumner