How to properly match the following message id format in a case statement
- by hsatterwhite
I'm trying to get this regex pattern working in a case statement to match a particular type of ID, which could be passed to the script. I need to match the exact number of alphanumeric characters with the dashes to differentiate this message id from anything else, which may be passed to this bash script.
An example of the message id format: c7c3e910-c9d2-71e1-0999-0aec446b0000
#!/bin/bash
until [ -z "$1" ]
do
case "$1" in
"")
echo "No value passed"
;;
[a-z0-9]\{8\}-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{4\}-[a-z0-9]\{12\})
echo "Found message ID: $1"
;;
*)
echo "Server $1"
;;
esac
shift
done