cabin_tools
07-22-09, 09:03 AM
I have this procedure that I use to confirm a string format... TAC40R0-I0
#
isInvalidILoadFormat()
{
/bin/expr "$1" : '^TAC[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
if [ $? -ne 0 ]
then
return 0
fi
return 1
}
I'm trying to get the `expr` to verify if the format starts with either TAC or DOC.
this works...
/bin/expr "$1" : '^TAC[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
this works...
/bin/expr "$1" : '^DOC[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
these do NOT...
/bin/expr "$1" : '^(TAC|DOC)[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
/bin/expr "$1" : '^\(TAC\|DOC\)[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
any ideas ?
\Jim
#
isInvalidILoadFormat()
{
/bin/expr "$1" : '^TAC[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
if [ $? -ne 0 ]
then
return 0
fi
return 1
}
I'm trying to get the `expr` to verify if the format starts with either TAC or DOC.
this works...
/bin/expr "$1" : '^TAC[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
this works...
/bin/expr "$1" : '^DOC[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
these do NOT...
/bin/expr "$1" : '^(TAC|DOC)[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
/bin/expr "$1" : '^\(TAC\|DOC\)[0-9][0-9]R[0-9][0-9]*-I[0-9][0-9]*$' > /dev/null
any ideas ?
\Jim