Use of findstr to seach regular expression in a batch file -


i create batch file check if file name has been written following rules. file name contains parameters (letters , numbers) splitted hyphen character : fin73-inv-2015-ann

i check first 2 parameters (department name , document type) , above check if hypen has been written more 1 time mistake . e.g. fin73--inv-2015-ann

i have tried command findstr seems doesn't work because if there 2 hyphens errorlevel 0 in case:

echo fin73--inv-2015-ann|findstr /i "^[a-z]-[a-z]"

do have more suggestions ?

thank you

for <startofstring><letter><letter><letter><number><number><hyphen><letter>

use findstr /i "^[a-z][a-z][a-z][0-9][0-9]-[a-z]"

if count of letters/numbers not known: findstr /i "^[a-z]*[0-9]*-[a-z]"


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -