I've been using the following regex below in a bash script on RHEL 5.5 using version
GNU bash, version 3.2.25(1)-release
I've tried using the script on RHEL 6.3 which uses GNU bash, version 4.1.2(1)-release
I assume there's been alot of changes to bash since that's quite a jump in revisions. I'm wondering if anyone can help me sort what might have to be modified in the code to make this work again.
If I enter an e-mail address in a simple format like:
user.user@test.com the scripts sees this as an invalid e-mail now, whereas before this would pass the regex.
GNU bash, version 3.2.25(1)-release
I've tried using the script on RHEL 6.3 which uses GNU bash, version 4.1.2(1)-release
I assume there's been alot of changes to bash since that's quite a jump in revisions. I'm wondering if anyone can help me sort what might have to be modified in the code to make this work again.
If I enter an e-mail address in a simple format like:
user.user@test.com the scripts sees this as an invalid e-mail now, whereas before this would pass the regex.
Code:
#!/bin/bash
echo Enter the users e-mail address.
read ADDRESS
if [[ "$ADDRESS" =~ "^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$" ]] ; then
echo $?
echo Proceeding!!
else
echo $?
echo You entered an invalid e-mail address!!!
exit 1
fi
Moderator's Comments: | ||
|