regex - PHP preg pattern needed to get required data from html source -


i'm reading html source code , need below data it.

lms.pagedata['product']['maxthreshold'] ='6'; 

in above example need catch 6.

you can use simple capture grouping :

"lms.pagedata\['product'\]\['maxthreshold'\] ='(\d)';" 

then need extract 1st group matched pattern!

demo

you can use look-around returns number directly without need first group :

"(?<=lms.pagedata\['product'\]\['maxthreshold'\] =')\d(?=';)" 

Comments