preg match - Regex pattern needed -
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 need capture newprice , oldprice values, please me regex pattern.
thanks!
you can use following match:
\['newprice'\] ='([\d.]*)'|\['oldprice'\] ='([\d.]*)'|\['price'\]\['value'\] = '([\d.]*)'
and extract $1
newprice
, $2
oldprice
, $3
value
.
see demo
Comments
Post a Comment