in reply to Re: Search & Replace repeating characters
in thread Search & Replace repeating characters

I agree with that. I mean C:\\temp is an invalid path under Windows. It would be better to fix the thing that generates this invalid path rather than trying to hack that path into a valid path. The crux of an X-Y problem is that the OP is asking the wrong question or that the question is not well specified.

Replies are listed 'Best First'.
Re^3: Search & Replace repeating characters
by kcott (Archbishop) on Apr 23, 2020 at 08:30 UTC
    "I mean C:\\temp is an invalid path under Windows."

    While I'm not disagreeing with that absolute statement, C:\\temp may be required under a Windows environment. I came across an example of this fairly recently.

    Consider a pp command on cmd.exe something like this (using Strawberry Perl):

    C:\some\dir>pp @long_list_of_options.txt -o filename.exe filename.pl

    Options (in long_list_of_options.txt) which include paths cannot be written like this for example:

    --link=C:\path\to\some.dll

    The parts like \X will be interpreted as backslashed escapes: resulting in just X, or special characters (e.g. newline, tab, and so on). The example option I showed would end up like:

    --link=C:path osome.dll

    In order to get it to resolve to the example shown, you'd need to write:

    --link=C:\\path\\to\\some.dll

    That doesn't mean that an XY Problem doesn't exist; it just shows that it might not exist. Having said that, the terminal \\\\ certainly looks highly dodgy.

    — Ken