阿拉伯语电子邮件地址的正则表达式 [英] Regular expression for email address in Arabic

查看:50
本文介绍了阿拉伯语电子邮件地址的正则表达式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

编辑

我搜索了一下,想为我的Web应用程序编写一个自定义正则表达式,但我仍然无法得到我想要的东西。

我想检查字符串是否通过此模式:

*STRING*STRING INCLUDING ALL CHARS*STRING INCLUDING ALL CHARS#

例如:

*STRING*the first string تست یک*the second string تست دو#

应返回True

*sdsdsd*the first string تست یکthe second string تست دو#

应返回FALSE(因为它不是*STRING*STRING*STRING#模式)

$check = preg_match("THE RULE", $STRING);

我在这里要求遵守规则,如果我的问题问错了,很抱歉...

推荐答案

检查字符串是否具有此模式:*STRING*STRING*STRING#

if (preg_match(
    '/^       # Start of string
    *        # Match *
    ([^*]*)   # Match any number of characters except *
    *        # Match *
    ([^*]*)   # Match any number of characters except *
    *        # Match *
    ([^#]*)   # Match any number of characters except #
    #        # Match #
    $         # End of string/x', 
    $subject, $matches))

然后使用

filter_var($matches[1], FILTER_VALIDATE_EMAIL)

检查第一个组是否可能包含电子邮件地址。

这篇关于阿拉伯语电子邮件地址的正则表达式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆