[TYPO3-core] RFC: Bug / Feature #5838: Get cli_dispatch.phpsh to work on windows platforms
Dmitry Dulepov [typo3]
dmitry at typo3.org
Wed Feb 27 20:37:05 CET 2008
Hi!
Martin Kutschker wrote:
> Odd. I tried to match a \. In the shell I need \\\ (within the regexp)
> to match a single \ in the path string:
>
> preg_match('/^([A-Z]:)?\\\/', $temp_PATH_thisScript)
>
> Why do I need three? Any other number raises the mentioned error.
Because two slashes inside PHP's quotes give one single slash in the string:
echo '\\'
outputs a single slash.
So, after PHP processing of quotes, you get two slashes passed to preg_match. Slash is treated as escape character inside regexp, so to escape the slash itself, you have to put it twice. As a result you get a single slash in the searched string.
\\\ =quotes=> \\ =regexp=> \
--
Dmitry Dulepov
TYPO3 core team
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
"Nothing is impossible. There are only limits to our knowledge"
More information about the TYPO3-team-core
mailing list