My programing World
A collection of programs and interview questions
Saturday, April 18, 2015
Regular Expression : example1
#!/bin/bash
REG="^[a-z]{0,3}[0-9]{2,8}[A-Z]{3,}\$"
read N
if [ $N -gt 0 ] && [ $N -le 100 ]; then
for((i=0;i<$N;i++))
do
read STR
if [[ $STR =~ $REG ]];then
echo "VALID"
else echo "INVALID"
fi
done
fi
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment