dsk710351 2014-03-08 16:09
浏览 202
已采纳

PHP正则表达式不匹配右括号

im using this regex to extract salaries from a file containing many different lines of text:

/(£|\€|GBP)\s*?(.)*?(pro-rata|\x28pro-rata\x29)/i

The test cases are like this:

"Relevant Quantity Surveying construction drawings Salary: £36,999 (pro-rata) in accordance with standard construction terms ..."

It matches:

  • £36,999 pro-rata
  • €36,999 pro-rata
  • GBP 36,999 pro-rata

But all matches of parenthesized 'pro-rata' are missing the right parenthtisis - i.e :

£36,999 (pro-rata

any ideas what wrong with this???

  • 写回答

3条回答 默认 最新

  • dongzhi5587 2014-03-08 16:18
    关注

    I tried using

    /(£|\€|GBP)\s*?(.)*?(pro-rata|\(pro-rata\))/i
    

    and it works for me as expected.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 向数据表用newid方式插入GUID问题
  • ¥15 multisim电路设计
  • ¥20 用keil,写代码解决两个问题,用库函数
  • ¥50 ID中开关量采样信号通道、以及程序流程的设计
  • ¥15 U-Mamba/nnunetv2固定随机数种子
  • ¥15 C++行情软件的tick数据如何高效的合成K线
  • ¥15 vba使用jmail发送邮件正文里面怎么加图片
  • ¥15 vb6.0如何向数据库中添加自动生成的字段数据。
  • ¥20 在easyX库下编写C语言扑克游戏跑的快,能实现简单的人机对战
  • ¥15 svpwm波形异常求解答