By registering with us, you'll be able to discuss, share and exchange private messages with other members of our community.

SignUp Now!

Is it a bug in for command..? please consider it..

alternation (|) in regex works perfectly in its own, but when it's inside 'for' block it doesn't. Why so? For example : echo %@regexsub[0,d:\\(c|d|e|f)\.+,d:\data] will report/echo 'd:\data'. What for /f "delims=" %a in ('dir /b d:\') echo %@regexsub[0,d:\\(c|d|e|f)\.+,"%a"] will give ' echo off '
I'm so sorry to everyone but I am about to answer my own question as I just found it accidentally. If one is going to use alternation in regex reside in a body/block of codes then he must preceed it with SETDOS /X-5 as it prevents command meaning of character | (pipe) which is used synonymly for alternation in every regex engine. He may then follow his regex line/code with SETDOS /X0 to restore the original setting
  • Like
Reactions: ron

Similar threads