I’m processing a large chunk of data, and am trying to return all the lines within it that contain the string “INFO:”. I’ve managed to get the pattern to return the data that I’m interested in, but wanted to know how to improve this regex pattern to omit the string that I’m matching (as well as the white space if possible), so that only the actual data I’m interested in is returned.
$pattern = "/^.*INFO:.*\$/m";
preg_match_all($pattern, $content, $matches);
INFO: framerate 25.00
INFO: width 480.00
INFO: height 360.00
INFO: audioinputvolume 75.00
INFO: audiocodecid mp4a
INFO: audiodatarate 48.00
Put the groups you are interested in matching in a subpattern
( )I think in your case it would look like:
Now you can see the contents of what was in the parentheses using
$matches[1][$match]