问题
In a "main directory" I have a lot of .txt files, in a lot of subdirectories. Something like
"C:\FirstDir\SecondDir\ MainDir\SomeSubDir_specific_subdirs_\ *.txt"
In each file I want to replace the line:
reference = someotherfile.ext
with
reference = MainDir\SomeSubDir\_specific_subdirs_\someotherfile.ext
I've built this expressions:
find: (reference = )(?!_this_dir_)(.*\.txt)
replace: \1MainDir\\SomeSubDir\\_this_dir_\\\2
but it requires me to open one folder at time and write the folder name "_this_dir_" each time.
There's a way to have (as an internal variable of SublimeText, or from some regex trick) the file directory so i can automate the whole process? (_specific_subdirs_ is the directory of the file i'm editing)
来源:https://stackoverflow.com/questions/58895118/regex-replace-text-with-part-of-the-file-full-path-in-sublimetext-3