in reply to Re^2: Using regex to separate parameters
in thread Using regex to separate parameters
If you are using a long file name that contains a space, use quoted strings to indicate where the file name ends and the arguments begin; otherwise, the file name is ambiguous. For example, consider the string "c:\program files\sub dir\program name". This string can be interpreted in a number of ways. The system tries to interpret the possibilities in the following order:
c:\program.exe files\sub dir\program name
c:\program files\sub.exe dir\program name
c:\program files\sub dir\program.exe name
c:\program files\sub dir\program name.exe
So if you want to behave like CreateProcess, you'll have to include file tests in your regexp or solution.
But like I said above, this is a wrong answer, but it might be the wrong answer you're looking for.
It's wrong cause it fails to handle "c:\program.exe files\sub" as "c:\program.exe files\sub.exe" if "c:\program.exe" exists.
It's wrong cause it fails to handle "c:\program.exe files\sub" as "c:\program.exe" if "c:\program.exe" doesn't exists or is currently unavailable (say due to network problems).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Using regex to separate parameters
by resistance (Beadle) on Jul 06, 2008 at 18:38 UTC | |
by ikegami (Patriarch) on Jul 06, 2008 at 19:03 UTC | |
by resistance (Beadle) on Jul 06, 2008 at 19:29 UTC | |
by jethro (Monsignor) on Jul 06, 2008 at 23:14 UTC |