Regex - fiename as parameter in search replace



  • Hi
    I want to add a canonical meta tag to all site’s pages by adding:

    <link rel=“canonical” href=“http://www.website.com/<filenmame>”>

    How do I do fetch the filename using regex across all site?
    (I know how to do it using the menu. I want to do it automatically).

    Thanks
    Rani



  • @RaniRani said in Regex - fiename as parameter in search replace:

    How do I do fetch the filename using regex

    Unfortunately that isn’t an operation that is supported by regex.



  • @RaniRani said in Regex - fiename as parameter in search replace:

    How do I do fetch the filename using regex across all site?

    I’m not sure I fully understand what you want to do however I provided a solution in this post which dealt with getting the filename of each opened file in Notepad++, saving it within the file and closing the file.

    Then a regex was used to update each file by copying that filename to selected (actually all) lines within the file. As @Alan-Kilborn stated the filename isn’t available to regex as a variable you can call on, but my first step was just a macro recording the use of menu options which then allowed a regex to complete the process.

    So take a look and see if maybe it might help. Reply back to this post if you think this can help you and you need a bit of extra help.

    I’m not on a PC currently otherwise I might have provided some more details.

    Terry


Log in to reply