How to validate input values

Hi

How would i validate value of a variable whether it is number,date or string

Thanks in advance

Sas

Um, this is input by user right ? And you want to be sure what he entered ? I guess one way would be to construct a regexp for each of conditions, something like : if $input equals [^some*mask$]; then action.
But this will require a lot of work and many conditions, as there may be more than one combination. Which language you're planning to use ?

or you can try using a case statement

case $val in 
     [0-9]*) echo "This is a number";;
     [A-Z]*) echo "This is a string" ;;
esac

Can you give us the valid formats for

  • number : integer, signed, float ?
  • date : dd/mm/YYYY, mm/dd/YYYY, dd-MMM-YYYY, YYYYmmdd ?
  • string : letters, upper/lower case, special chars allowed ?

I am planning to use PL/SQL

Hi

number : integer, signed, float ?Any valid number.No character will be allowed
date : dd/mm/YYYY, mm/dd/YYYY, dd-MMM-YYYY, YYYYmmdd ?Any valid date
string : letters, upper/lower case, special chars allowed ?Any string.No date allowed.Numbers can be allowed.

Regds
Sas