1

私はhtmlコードを持っています:

<a href="javascript:void(0);" id="seller0-showAllImage" onclick="showPlusBox(0,'/products/plusbox?cid=9286328115358229395&amp;authorid=2860562')" class="fl">

結果として、文字列のみが必要です:

/products/plusbox?cid=9286328115358229395&amp;authorid=2860562

HTMLコードから正規表現で一致させるにはどうすればよいですか? ありがとう!

4

2 に答える 2

3

Match:

showPlusBox(0,'([^']+)')

Reference $1 is then the string you're looking for.

Of course, this depends pretty much on the exact strings you want to match; where it's embedded, etc. With a single example there isn't much to extrapolate. Honestly, the Regex

/products/plusbox\?cid=9286328115358229395&amp;authorid=2860562

would also match what you're looking for, for example.

于 2011-07-07T14:22:54.707 に答える
2

This regex:

/products/plusbox\?cid=9286328115358229395&authorid=2860562

Matches it.

If you want a more generic expression, please provide more info.

于 2011-07-07T14:23:39.040 に答える