Save REGEX



  • hello, is there any option to save regular expressions in the notepad++ like in GrepWin or other text editors?



  • Hello, Vasile,

    I’m afraid that no native option exists, in N++ :-(( So, expect for the obvious idea to keep your list of favourite regexes in a text file, you should have a look to the config.xml file !

    Here is, below, the interesting section FindHistory, from my OWN config.xml file :

    <FindHistory nbMaxFindHistoryPath="10" nbMaxFindHistoryFilter="10" nbMaxFindHistoryFind="10" nbMaxFindHistoryReplace="10" matchWord="yes" matchCase="no" wrap="no" directionDown="yes" fifRecuisive="yes" fifInHiddenFolder="no" dlgAlwaysVisible="no" fifFilterFollowsDoc="no" fifFolderFollowsDoc="no" searchMode="2" transparencyMode="1" transparency="156" dotMatchesNewline="no">
            <Find name="(?-s)(^.*\R)\1+" />
            <Find name="\b(the|you|in)\b" />
            <Find name="^\d+A|(\R\d+B)" />
            <Find name="^\d+A" />
            <Find name="(?-i)^\d+A" />
            <Find name="(?-i)^\d+A|(\R\d+B)" />
            <Find name="\d+A|(\R\d+B)" />
            <Find name=" 106 " />
            <Find name="VK_PLUS" />
            <Find name="I love \w+ car" />
            <Replace name="\1" />
            <Replace name="?1\t" />
            <Replace name="(?1\t )" />
            <Replace name="abc$0xyz" />
            <Replace name="$0\r\n" />
            <Replace name="(?1\1)(?2 )" />
            <Replace name="(?1\1: )" />
            <Replace name="\1\r\n" />
            <Replace name="(?1n)(?2s)(?3w)(?4e)" />
            <Replace name="\1 \2 \3" />
        </FindHistory>
    

    I suppose that changing the nbMaxFindHistoryFind AND/OR the nbMaxFindHistoryReplace parameters, from the default number 10, would work :-)) I didn’t try it, yet, anyway !

    BEWARE: you must, preferably :

    • Close any instance of Notepad++

    • Open the config.xml file, with an OTHER editor than N++ ( Notepad, Wordpad, … ) , then save the changes

    • Re-start Notepad++

    Best Regards,

    guy038



  • hello guy38. Yes, it’s ok. I wanted to save my special regex into notepad ++ so that not to open the file with all my regex expressions.


Log in to reply