Find string of relative directory with regexp
1 view (last 30 days)
I have a string in a file that I want to find and replace. The string contains a directory that is defined relative to another location variable and therefore contains '..\' type callings in the name. How can I find something like this with regexp? I am able to locate it fine with strfind, so I haven't misspelled anything, but regexp can't find it. I assume this is because something is being treated as an escape character, but how can I get around that?
txt = 'myfile = ''..\..\pwd''; myotherfile = ''..\..\pwd'';';
txtfind = strfind(txt,'myfile = ''..\..\pwd'';')
txtrerf = regexp(txt,'myfile = ''..\..\pwd'';','match')
0 x 0 empty cell array