-3

我有域名列表和其他信息

domain1.com;somedata1;somedata2;2012-03-02;somedata3;somedata4;somedata5
domain2.com;somedata5;somedata8;2013-06-18;somedata4;somedata2;somedata1
domain3.org;somedata9;somedata2;2012-03-02;somedata3;somedata4;somedata5
domain4.com;somedata1;somedata2;2015-04-18;somedata3;somedata4;somedata5
domain5.com;somedata1;somedata2;2012-03-02;somedata3;somedata4;somedata5
domain6.biz;somedata5;somedata8;2013-06-18;somedata4;somedata2;somedata1
domain7.org;somedata9;somedata2;2012-03-02;somedata3;somedata4;somedata5
domain8.com;somedata1;somedata2;2015-04-18;somedata3;somedata4;somedata5

我需要获取日期为 2012-03-02 的 .com 域列表

我需要使用类似的东西:

preg_match('(.*?.com)   ????  /i', $data, $matches);
4

2 回答 2

2

你可以试试这个:

preg_match_all('~^\S+?.com(?=;[^;]*+;[^;]*+;2012-03-02;)~mi', $data, $matches);
于 2013-06-22T16:50:50.283 回答
1
  preg_match_all( '/([A-Z0-9][A-Z0-9_-]*(?:\.com*)+):?(\d+)?\/?(.+?)(2012\-03\-02)/i', $data, $matches );
  print_r( $matches[1] );
于 2013-06-22T16:54:21.767 回答