I think this is probably a fairly easily answered question:
Im new to regular expressions in general, but I have recently heard that filter_var is almost replaceing the expressions.
I can see, after looking at the function, that I could validate emails in general. But is there capabilities to narrow the validation?
My issue is im trying to validate an email to only return true if it ends in @boisestate.edu OR @u.boisestate.edu. I cant seem to figure out if filter_var has those kinds of specific capabilities. Any help would really be appreciated! Also, if you have a reg expression or filter_var function that would suit this validation…Id really appreciate it!
Use
filter_varto validate the e-mail, then check if it ends in@boisestate.edu, etc. afterward usingsubstr_compare($theEmail, $theSuffix, -strlen($theSuffix), strlen($theSuffix)) === 0.