• Regex: Delete all the instances of <title> html tag, except the first one

    8
    0 Votes
    8 Posts
    370 Views
    mkupperM

    @Hellena-Crainicu I was puzzled by your comment. I suspect you were testing by having the expression you were testing with at the top of the file. In that case the first title was in the expression itself.

    I modified my search expression slightly to replace < with \x3c so that we can have the search/replace expression within the file for testing. I put it at the bottom in these examples.

    Here is the test I ran:

    Original data <p>但是减脂期可不一定就意味着每天只吃水煮鸡胸和水煮西蓝花,完全苦行僧一样的生活。如果在营养均衡的三餐之间适当的尝试一些健康的小零食,不仅能为减脂期提供动力和新鲜感,还可以为生活增添不少的趣味呢。</p>除此之外,从营养学角度,适当的加餐可以预防三餐之间出现低血糖的现象,还能防止因为饥饿而在下一餐中暴饮暴食,摄入过多热量的情况发生。</p>因此,健康的小零食不仅有助于完成减脂目标,还能让你的减肥期丰富多彩,何乐而不为呢?下面就来推荐给大家10种好吃又健康的小零食。</p> <title>用正确方式打开 MyGainer增健肌粉! - MYPROTEIN™</title> blah bhla blah bhla <title>Home is me</title> blah bhla <title>Payton is your name</title> Search: (?s)(\x3ctitle>.*?\x3c/title>.*?)\x3ctitle>.*?\x3c/title> Replace: $1

    ###First pass
    This is after doing search-replace-all one time. It removed the second title that was on line 5.

    <p>但是减脂期可不一定就意味着每天只吃水煮鸡胸和水煮西蓝花,完全苦行僧一样的生活。如果在营养均衡的三餐之间适当的尝试一些健康的小零食,不仅能为减脂期提供动力和新鲜感,还可以为生活增添不少的趣味呢。</p>除此之外,从营养学角度,适当的加餐可以预防三餐之间出现低血糖的现象,还能防止因为饥饿而在下一餐中暴饮暴食,摄入过多热量的情况发生。</p>因此,健康的小零食不仅有助于完成减脂目标,还能让你的减肥期丰富多彩,何乐而不为呢?下面就来推荐给大家10种好吃又健康的小零食。</p> <title>用正确方式打开 MyGainer增健肌粉! - MYPROTEIN™</title> blah bhla blah bhla blah bhla <title>Payton is your name</title> Search: (?s)(\x3ctitle>.*?\x3c/title>.*?)\x3ctitle>.*?\x3c/title> Replace: $1

    ###Second pass
    This is after doing search-replace-all twice. The first pass removed second title that was on line 5 and the second pass removed the third title that was on line 7.

    <p>但是减脂期可不一定就意味着每天只吃水煮鸡胸和水煮西蓝花,完全苦行僧一样的生活。如果在营养均衡的三餐之间适当的尝试一些健康的小零食,不仅能为减脂期提供动力和新鲜感,还可以为生活增添不少的趣味呢。</p>除此之外,从营养学角度,适当的加餐可以预防三餐之间出现低血糖的现象,还能防止因为饥饿而在下一餐中暴饮暴食,摄入过多热量的情况发生。</p>因此,健康的小零食不仅有助于完成减脂目标,还能让你的减肥期丰富多彩,何乐而不为呢?下面就来推荐给大家10种好吃又健康的小零食。</p> <title>用正确方式打开 MyGainer增健肌粉! - MYPROTEIN™</title> blah bhla blah bhla blah bhla Search: (?s)(\x3ctitle>.*?\x3c/title>.*?)\x3ctitle>.*?\x3c/title> Replace: $1

    If you watch the status line at the bottom of the search/replace box you will see:

    After pass 1: Replace All: 1 occurrence was replaced in entire file After pass 2: Replace All: 1 occurrence was replaced in entire file After pass 3: Replace All: 0 occurrences were replaced in entire file

    While your examples had the titles on their own lines I had coded to allow them to be anywhere in a line and for them to span lines as that’s what HTML allows. If you want to only support titles on a line by itself then we can add some anchoring:
    Search: (?s)^(\x3ctitle>.*?\x3c/title>\R.*?\R)\x3ctitle>.*?\x3c/title>$
    Replace: $1

    Even that is not perfect as it allows titles to span or more lines. If you insists on only matching titles on one line and not to span them then toggle the dot/EOL spanner flag:
    Search: ^(\x3ctitle>(?-s).*?\x3c/title>\R(?s).*?\R)\x3ctitle>(?-s).*?\x3c/title>$
    Replace: $1

    As you can see, the expression is getting more complicated to deal with the edge cases and requirements.

  • I needed a help in something

    10
    1 Votes
    10 Posts
    741 Views
    guy038G

    Hello, @mohammad-Al-Maaitah, @terry-r, @Peterjones and All,

    If we suppose that each line does NOT contain two or more colon chars ( : ), then the simple regex syntax, below, should be enough :

    SEARCH (?-s)^.{5,}:.*\R?

    REPLACE Leave EMPTY

    If several colon chars may exist in one line, we would have to distinguish between multiple cases ! But, this is on other story !

    Best Regards,

    guy038

  • Replace with - question for advance formating

    3
    1 Votes
    3 Posts
    199 Views
    D

    @Coises Thank you - it did the work perfectly!

  • How do I search for multiple names at once? Notebad++

    9
    1 Votes
    9 Posts
    702 Views
    mkupperM

    @sabry-farg
    Using regular expression mode you search for

    ahmed|saeed|emad|sameer

    The | symbol is usually on keyboards above the enter key. It’s known as vertical line, vertical bar, or pipe symbol. It has a rather long article on Wikipedia. https://en.wikipedia.org/wiki/Vertical_bar

    Nearly always we will see this in parentheses such as:

    (ahmed|saeed|emad|sameer)

    which then makes the name available when doing a search/replace using either \1 or $1

  • Duplicate Each Block of Lines Consecutively

    3
    2 Votes
    3 Posts
    1k Views
    M

    @PeterJones Thanks for the solution! I really appreciate that. So it turns out that I can use regex to do it. I’m embarassed that my regex skill hasn’t improved much. It seems to decline instead after long hiatus. If time allows, I want to relearn it so that I don’t have to keep asking here.

  • bypass admin

    2
    0 Votes
    2 Posts
    353 Views
    PeterJonesP

    @Benjamin-Zimmerman ,

    The portable edition, which can be unzipped and run into any directory where you have write permission, can be used with no admin access needed.

    But please note that I am not advocating violating your company’s IT policies: if you are not allowed to install or use software that hasn’t been approved by your IT department, then don’t.

  • Macros not saving

    13
    2 Votes
    13 Posts
    1k Views
    Robert RothR

    @mkupper Whelp, that fixed it. Once I replaced it with the former tmp, it worked just fine, and I’m able to modify macros.

    Still not quite sure why this was the case, but this definitely is a simpler test/fix than making a copy of the entire directory.

    Thanks, everyone, for the assistance.

  • Mark with same function jumping to row as Find?

    7
    0 Votes
    7 Posts
    422 Views
    Alan KilbornA

    @PeterJones said in Mark with same function jumping to row as Find?:

    But Mark with the ☑ Bookmark Line option turned on will also bookmark the lines, then F2 (Search > Bookmark > Next Bookmark) will navigate you through the bookmarked lines.

    I don’t know if this works well if there are already a smattering of bookmarks, and the newest text match can be anywhere in the file, i.e., OP wants to go to the specific text, which may not be the next bookmark…

    Or, even without Bookmark Line, after doing a normal Mark, you can use F3 (Search > Find Next) to navigate to the next match.

    Ah, yes, THAT may be the solution!

  • 1 Votes
    2 Posts
    171 Views
    mkupperM

    @Venugopal-MV said in I need to replace C: 0 d: 2 d: 1 with C: 0 d: 2 d: 2 in the below content wherein ""MicroSCADA DV DataSource" appears in the previous line.:

    I need to replace C: 0 d: 2 d: 1 with C: 0 d: 2 d: 2 in the below content wherein "“MicroSCADA DV DataSource”

    Try this using Regular Expression mode:
    Search: ^(C"MicroSCADA DV DataSource".+\R)C: +0 +d: +2 +d: +1
    Replace: $1C: 0 d: 2 d: 2

  • Notepad++ does not change after update

    3
    0 Votes
    3 Posts
    498 Views
    xomxX

    @AshutoshTiwari2017 said in Notepad++ does not change after update:

    Start-Process -FilePath “$env:TEMP$( Split-Path -Path $DownloadUrl -Leaf )” -ArgumentList “/S” -Wait

    As you are using the silent N++ installation, it could be connected to:
    https://github.com/notepad-plus-plus/notepad-plus-plus/issues/10189

    v8.6+ installers contain a fix for such partial incomplete installations:
    https://github.com/notepad-plus-plus/notepad-plus-plus/commit/5c80be7667eb84f0345ef827cab030724c2e13c6

    But still - the N++ cannot be silently installed/upgraded when an instance of N++ is running. To allow this a new installer switch “/closeRunningNpp” needs to be implemented for the silent installations.

  • How to edit and save my theme?

    2
    1 Votes
    2 Posts
    13k Views
    PeterJonesP

    @Martin-Vlach ,

    Copy themes\original.xml to themes\your.xml , and change the name inside the XML to Your Theme Name Open Notepad++ Settings > Style Configurator > Select Theme: Your Theme Name Use Style Configurator to edit your theme When you exit Notepad++, it will save your theme

    You would then save a copy of themes\your.xml and then put it on any new computer / new installation where you want that theme.

    (Clarification: original.xml, your.xml and Your Theme Name are intended as placeholders: use reasonable values, not literally what I put.)

  • Bug report: Indented and aligned carriage return not working

    13
    0 Votes
    13 Posts
    859 Views
    MattexDM

    @PeterJones That check auto-indent was disabled, the problem is solved. Thank you so much for your help and your patience

  • disable highlighting of code blocks

    8
    1 Votes
    8 Posts
    1k Views
    MattexDM

    @Lycan-Thrope I know but I use it momentarily to simulate a written exam I have to take

  • An application suddenly stopped processing a Notepad++ text file

    9
    1 Votes
    9 Posts
    726 Views
    Alan KilbornA

    @mkupper said in An application suddenly stopped processing a Notepad++ text file:

    I accidentally pressed some combination of buttons that converted one of the spaces into some kind of special space - longer than usual. I don’t know what exactly that was, but it was quite invisible between the lines, and I only discovered it by moving the cursor up by hand.

    It’s a pity you don’t have more exact information about this, because I’m fairly certain you can’t get a “special space” in this way (although @Coises recently pointed out some non-English keyboard where a special keycombo involving the spacebar inserts a “special space” – so maybe that’s it? – see HERE).

    Notepad++'s default settings, shown here:

    5bf0ce67-de69-423e-944b-dcd843311242-image.png

    should show you if you get any kind of “special character” inserted into your document. The effect would be very obvious, e.g. see ZWNJ character in the sample below:

    0f1f6410-f8fa-4db7-b4b3-05d55bf35655-image.png

    Notepad++ needs to have some warning system for these types of very casual replacements. I probably held down Shift or Control or Alt, and voila. Maybe a beep?

    I think the visual effect is enough. There shouldn’t be any other sort of “casual replacement” – if you think there is, please provide further detail.

  • Help finding search results panel

    5
    1 Votes
    5 Posts
    361 Views
  • Multi-edit

    8
    1 Votes
    8 Posts
    2k Views
    PeterJonesP

    @Alan-Kilborn said in Multi-edit:

    No one would actually use these commands from the menus.

    I cannot remember any more keystrokes, so I’m not likely to assign a keyboard shortcut. Instead, if I find myself wanting to use the new features, I’ll probably add them to the contextMenu.xml, so they’re just a local right-click away.

    … But yes, if I do end up using them often, it will need to be easier access than having to move my mouse cursor up to the main menu system.

  • how to change first letter after colon uppercase?

    2
    1 Votes
    2 Posts
    177 Views
    guy038G

    Hello, @glo and All,

    Not difficult with regular expressions !

    SEARCH (?<=:)\w

    REPLACE \u$0

    Radio button Regular expression set

    Click on the Replace All button

    Best Regards,

    guy038

  • How to copy all phone numbers with a specific format

    3
    1 Votes
    3 Posts
    240 Views
    Marcos MiguelM

    @Coises THANK YOU SO MUCH!

  • Help with regex: bug?

    4
    0 Votes
    4 Posts
    244 Views
    Alan KilbornA

    By default the regex engine is case insensitive meaning a-z and A-Z are the same.

    it did not occur (to me) that a language like regex with separate options for uppercase and lowercase could have any case insensitivity enabled by default.

    It actually isn’t case sensitive by default. But because the Notepad++ user interface to searching has a Match case checkbox, the state of that become part of the operation. If uncheckmarked when the operation starts, then, well…

    For regex purists, perhaps always starting your regex with (?-i) – which overrides the state of the Match case checkbox – is the way to go.

  • Xdebug connects tothe Dbgp plugin but doesn't work

    6
    1 Votes
    6 Posts
    535 Views
    rdipardoR

    I will wait for feedback on the latest version before updating the distributed plugin list: https://bitbucket.org/rdipardo/dbgp/src/v0.14.2/CHANGELOG.txt

    This thread has already climbed the search engine rankings for Xdebug issues, so I didn’t want to leave the impression that DBGp is unmaintained.

    Lesson learned: Delphi Strings are implicitly passed by reference (as if the type identifier were PChar instead). That means this method would overwrite a validly escaped file URI with the file’s literal path — spaces, backslashes, and all — which the debugger obviously can’t find. Still no luck getting UNC paths to resolve to proper URIs, but that seems to be a known issue with Xdebug itself.

    Simply getting the source command to execute was only the beginning of the trouble. The message parsing code was written for an obsolete spec, when error nodes were simple text elements. Treating them as such was raising DOM exceptions that obscured real debugger errors, and calling methods on a missing node object would cause the occasional access violation. Then I found out the socket destructor would be invoked twice; once when the temporary source map was unloaded, once more when the socket closed, and the second time around it tried to look up the same unloaded file, calling a method on a member object it had already freed.

    All of this came to light only after source mapping started to work, but only for local files in ideal conditions, which makes me wonder about the stability of future releases. The feature set of current versions is definitely crippled, but that also means they can’t fail too dangerously. Like the classic car it really is, DBGp is not for daily driving.