Regex empty string or email

Regex empty string or email

Asked on January 4, 2019 in Regex.
Add Comment


  • 2 Answer(s)

    Empty string  will match regex pattern:

      ^$
    

    Below will match email or an empty string:

    (^$|^.*@.*\..*$)
    
    Answered on January 4, 2019.
    Add Comment

    Alternately use this code for Regex empty string or email:

    /\A(INTENSE_EMAIL_REGEX|)\z/i
    
    

    In reverse order:

    /\A(|INTENSE_EMAIL_REGEX)\z/i
    
    
    Answered on January 4, 2019.
    Add Comment


  • Your Answer

    By posting your answer, you agree to the privacy policy and terms of service.