dongleman4760 2010-11-15 04:49
浏览 28

使用preg_match创建正则表达式

I want to create a regular expression for below string. The dynamic portion (i.e. for which expression needed is in bold text)


The mail system

**email address**: host mx2.hotmail.com[65.55.92.152] said:
550 Requested action not taken:
**mailbox unavailable** (in reply to RCPTTO command)

Basically I want that my regexp search for email and the "mailbox unavailable".

So it will search for mail first and then search for the string "mailbox unavailable".

How can I do this? I need to use preg_match php function for this.


Edit:

Actually I am doing code to find the bounced mail. I am placing the source code of the full email to match. one of my email giving above error. So I need to check for that error contain in email code or not. If that code found then it will return error accordingly. So in that error message dynamic parts are email address, ip in square brackets and the string mailbox unavailable.

  • 写回答

2条回答 默认 最新

  • doujiangao4229 2010-11-15 05:19
    关注

    The regex for e-mail address alone should give you an idea of the complexity of what you're trying to achieve:

    http://fightingforalostcause.net/misc/2006/compare-email-regex.php

    评论

报告相同问题?

悬赏问题

  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计
  • ¥15 路易威登官网 里边的参数逆向
  • ¥15 Arduino无法同时连接多个hx711模块,如何解决?
  • ¥50 需求一个up主付费课程