0

Using Notepad ++, Dreamweaver or some other editor, is it possible to use a regex which uses file name in the replace field?

For example: There are files: firstfile.html and secondfile.html

Find: yyy
Replace: "some regex for files name"

And then in those files wherever yyy is found it will be replaced with the file's name.

In firstfile.html - if there is yyy it will be replaced with firstfile.

In secondfile.html - if there is yyy it will be replaced with secondfile.

user3082821
  • 195
  • 2
  • 10
  • [Same issue](http://stackoverflow.com/questions/19840541/find-text-and-replace-for-filename-on-notepad), basically you can't without writing a plugin or using an altogether other language/tool. – HamZa Apr 02 '14 at 08:54
  • Make a tool to do this, and you can use it again and again. – songyuanyao Apr 02 '14 at 08:59

1 Answers1

0

As for "some other editor", the answer is yes (EditPad can do this):

EPP screenshot

(I removed some parts of the user interface to save space in this screenshot).

Tim Pietzcker
  • 328,213
  • 58
  • 503
  • 561
  • There is a problem. It really work BUT - it seems that all files must be open in order to do replace job. Is it possible it won't replace whole folder as dreamweaver for example? Folder contains a lot of files that need change I mean a lot... I'm new to editpad pro perhaps I miss something.... I download editp ro 7 free trial... – user3082821 Apr 02 '14 at 10:48
  • @user3082821: Right, EditPadPro only works on files opened in the editor. There'a different tool that works on folders/disks etc. (PowerGREP), but that's much more expensive. You could open all the files in your folder and click on the "Files" option in the regex search/replace panel to tell EPP to apply the regex to all the opened files. – Tim Pietzcker Apr 02 '14 at 11:13
  • Your solution with editpad pro is good. I know your name on this site from other questions. I think, if I remember other topics, that you are expert for regex problems. Thank you very much for your help. Just to mention I download PowerGrep but I can not find replace field. – user3082821 Apr 02 '14 at 13:13
  • Can you please check the link below :http://stackoverflow.com/questions/31294441/rename-file-name-using-some-text-from-that-same-file – user3082821 Jul 08 '15 at 14:15