I'm a bit baffled by regex and I'm trying to get percentage progress from a line of a command line programme in PHP. A combination of problems.
I run a script from command line using exec
exec('python scriptos.py', $returnData, $returnCode);
Then I'm thinking to cycle through the returnData (which is changing live) - so I'm unsure how I can parse the response? I was going to foreach through $returnData - to find this...
[download] 1.0% of 218.08M at 431.42k/s ETA 08:32
Then I'm really struggling to work out the regex to get that percentage. My theory was to look for a number and ending percentage.
So, two way question
- How can I get access to this in PHP whilst the process is running?
- How do I get the data via regex preg_match?
Any help would be most helpful!