RegEX in Notepad++ removing different text with \ in it

  • If I have a list of text in Notepad++ and I want to replace like this


    Which needs to be replaced into


    with the only thing retained is the test_ from the previous list.

    I have it somewhat working, but I can’t get it to do * and \ together.

    So what would be the correct RegEX in Notepad++ to replace this way?

  • @Magnum-Opus ,

    I have it somewhat working, but I can’t get it to do * and \ together.

    So show us what regex you’ve tried, and show us the results, explaining why it doesn’t match what you wanted. Otherwise, you’re asking us to start from scratch, rather than knowing what you tried and using that as a starting point.

    Also, please properly markup your post, so that we see the exact data, rather than letting the forum mangle your data for you (see the FYI below). Given the backslashes and asterisks in your post, it is highly likely that what we see no longer accurately reflects your data; when you preview your post, you can see what we will see, so you will know whether the forum will mangle things or not. If you properly markup (using the syntax in the links below, or using the formatting bar), then we will be more confident that we accurately see your data.

    Please read the following:


    This forum is formatted using Markdown, with a help link buried on the little grey ? in the COMPOSE window/pane when writing your post. In the new-and-improved forum, there is the nice </> button, which automatically marks up the text as code (so that the forum won’t mangle your example text), and you can imbed images using the little image button. If you want to do manual markdown in your post, please see @Scott-Sumner’s post in the “how to markdown code on this forum” topic, and my updates near the end. It is very important that you use these formatting tips – using single backtick marks around small snippets, and using code-quoting for pasting multiple lines from your example data files – because otherwise, the forum will change normal quotes ("") to curly “smart” quotes (“”), will change hyphens to dashes, will sometimes hide asterisks (or if your text is c:\folder\*.txt, it will show up as c:\folder*.txt, missing the backslash). If you want to clearly communicate your text data to us, you need to properly format it.

    If you have further search-and-replace (“matching”, “marking”, “bookmarking”, regular expression, “regex”) needs, study this FAQ and the documentation it points to. Before asking a new regex question, understand that for future requests, many of us will expect you to show what data you have (exactly), what data you want (exactly), what regex you already tried (to show that you’re showing effort), why you thought that regex would work (to prove it wasn’t just something randomly typed), and what data you’re getting with an explanation of why that result is wrong. When you show that effort, you’ll see us bend over backward to get things working for you. If you need help formatting, see the paragraph above.

    Please note that for all regex and related queries, it is best if you are explicit about what needs to match, and what shouldn’t match, and have multiple examples of both in your example dataset. Often, what shouldn’t match helps define the regular expression as much or more than what should match.

  • C:\Ark\Servers\EOGamer2.0-PvP-Ragnarok\ShooterGame\Content\Mods\731604991\doors\gates\small\glass\EngramEntry_

    in fact ANY text before and including


    is to be replaced to this


    This works, but is not what I want




    doesn’t and doesn’t select anything

    _I am completely at a loss on how to do this with RegEX. The documentation isn’t very clear on how to proceed with this.

  • @Magnum-Opus

    Your search term *\\EngramEntry_ doesn’t work because you used the quantifier * without a preceeding character to define the character(s) the quantifier should operate on.

    Because you want to match any characters before \EngramEntry_ you have to insert . which means an arbitrary character. This results in the search term:


    BUT your replacement string OverrideNamedEngramEntries=(EngramClassName="EngramEntry_ isn’t error-free as well. You need to escape the ( character because it’s a meta character in regular expressions. Thus your replacement string should be:


    If you would like to read a really good regular expression manual visit this site. At some points in the manual you have to know the exact flavour of regular expressions used at your site. Notepad++ uses the boost lib regex flavour.

Log in to reply