Leave feedback
  • Question

    Regexmatch function validate email address not working

Enter a new topic
  • loke kk loke kk
    0 likes 471 views

    Hi All,

    I'm using streamserve ver. 5.6.0.

    I'm trying to use the Regexmatch funtion to validate an email address is it valid or not. Below are the script:-

    $mystring = "LOKE@GMAIL.COM";

    if(Regexmatch($mystring, "\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b") = 1)
    {
    log(0, "Success");
    }
    else
    {
    log(0, "Fail.");
    }
    The regex syntax is copy from this link ("http://www.regular-expressions.info/email.html"). But  what i get the result is I always get Fail message. Is it the Regexmatch function bug? Thank you. From, KK.loke

    Friday 22 January, 2016
  • Best Answer
    Stefan Eklund Stefan Eklund StreamServe Employee
    2 likes

    Hi Loke, It seems that the word boundry \b syntax doesn't work.

    If I remove it the test will be successful

    if(Regexmatch($mystring, "[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}") = 1)

    /stefan

    Friday 22 January, 2016
  • loke kk loke kk
    0 likes

    It's work!! brilliant!! Thanks Stefan.

    Friday 22 January, 2016