使用Ruby,所以我认为这是Perl正则表达式。例如:在':'之后匹配所有内容,直到第一个非空行,然后只匹配除空行外的所有内容
E-mail Address: [email protected] Billing Address: Harry Smith 3423 My Lane SOME CITY, CA 94105 United States
我想匹配
E-mail Address: [email protected]
和
Billing Address:
Harry Smith
3423 My Lane
SOME CITY, CA 94105
United States
任何想法?
这就是我现在所拥有的(KA提供):
/(.+?):(?:\s+)?([\s\S]+?)\r?\n(?=\r?\n)/g
唯一的问题现在的问题是,它不会停止在该行突破
@Tass更新了我的尝试 – chintanparikh 2013-03-12 02:48:51
谢谢!好多了。 – Tass 2013-03-12 03:02:52
您还需要'帐单地址:'位? – 2013-03-12 03:17:09