-1

我有 html 字符串:

    <SCRIPT LANGUAGE="JavaScript">
   prod155920017Matrix = new Array();
   prod155920017Matrix[0] = new Array();
   prod155920017Matrix[1] = new Array();
   prod155920017Matrix[2] = new Array();
   prod155920017Matrix[3] = new Array();
   prod155920017Matrix[4] = new Array();
   prod155920017Matrix[5] = new Array();
   prod155920017Matrix[6] = new Array();
   prod155920017Matrix[7] = new Array();
   prod155920017Matrix[8] = new Array();
   prod155920017Matrix[9] = new Array();
   prod155920017Matrix[0][0] = new product('0','prod155920017','sku143650081','36.0B/6.0B','BLACK','Joni Snake-Print Thong Sandal',false,0,'',8,'3','/category/images/prod_stock1.gif',new Array(),'','false',9999,'null');
   prod155920017Matrix[0][0].vendorRestrictedDates[0] = '20130903';
   prod155920017Matrix[0][0].vendorRestrictedDates[1] = '20131129';
   prod155920017Matrix[0][0].vendorRestrictedDates[2] = '20130902';
   prod155920017Matrix[0][0].vendorRestrictedDates[3] = '20130101';
   prod155920017Matrix[0][0].vendorRestrictedDates[4] = '20121225';
   prod155920017Matrix[0][0].vendorRestrictedDates[5] = '20130528';
   prod155920017Matrix[0][0].vendorRestrictedDates[6] = '20140102';
   prod155920017Matrix[0][0].vendorRestrictedDates[7] = '20140101';
   prod155920017Matrix[0][0].vendorRestrictedDates[8] = '20131128';
   prod155920017Matrix[0][0].vendorRestrictedDates[9] = '20131226';
   prod155920017Matrix[0][0].vendorRestrictedDates[10] = '20121226';
   prod155920017Matrix[0][0].vendorRestrictedDates[11] = '20130527';
   prod155920017Matrix[0][0].vendorRestrictedDates[12] = '20130705';
   prod155920017Matrix[0][0].vendorRestrictedDates[13] = '20131225';
   prod155920017Matrix[0][0].vendorRestrictedDates[14] = '20130102';
   prod155920017Matrix[0][0].vendorRestrictedDates[15] = '20130704';


   prod155920017Matrix[0][0].storeFulfillStatus = 'false';
   prod155920017Matrix[1][0] = new product('0','prod155920017','sku143650082','36.5B/6.5B','BLACK','Joni Snake-Print Thong Sandal',false,0,'',10,'3','/category/images/prod_stock1.gif',new Array(),'','false',9999,'null');   
</SCRIPT>

我尝试使用这个正则表达式:从脚本标签new product(\([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)获取数据:'36.0B/6.0B','BLACK' 。但我不能。请帮我弄到它们。非常感谢大家!

4

2 回答 2

0

反斜杠在错误的位置:

new product\(([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)
于 2013-02-26T05:26:16.683 回答
0
\'\d{2}\.\d[A-Z]\/\d\.\d[A-Z]\',\'[\w]+\'

这应该会给你预期的结果。由于正则表达式只能进行模式匹配,因此您不能使用正则表达式在结果字符串周围“添加字符”(和),您必须使用 python 来完成。

于 2013-02-26T06:19:21.800 回答