If have below text:
<script>
LMS.pageData['product']['percentageDiscount'] ='26';
LMS.pageData['product']['newPrice'] ='37';
LMS.pageData['product']['oldPrice'] ='50.0';
LMS.pageData['product']['savedAmount'] ='13';
LMS.pageData['product']['price']['value'] = '37';
</script>
Then I need to capture newPrice and oldPrice values, please help me for Regex pattern.
thanks!
You can use the following to match:
\['newPrice'\] ='([\d.]*)'|\['oldPrice'\] ='([\d.]*)'|\['price'\]\['value'\] = '([\d.]*)'
And extract $1
as newPrice
, $2
as oldPrice
and $3
as value
.
See DEMO
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.