-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
\'\d{2}\.\d[A-Z]\/\d\.\d[A-Z]\',\'[\w]+\'

これにより、期待される結果が得られるはずです。正規表現はパターン マッチングしか実行できないため、正規表現を使用して結果文字列の周りに ( および ) のような「文字を追加」することはできません。Python を使用してそれを行う必要があります。

于 2013-02-26T06:19:21.800 に答える
0

バックスラッシュが間違った場所にあります:

new product\(([^,]*),([^,]*),([^,]*),([^,]*),([^,]*)
于 2013-02-26T05:26:16.683 に答える