Name: Anonymous 2007-06-15 14:38 ID:kQPwzXix
I'm not quite the EXPERT PROGRAMMER when it comes to regular expressions. I has a string:
$eq = "If the bobsled has to go 30 meters in 5 seconds starting from rest, then I think we could find the acceleration using: %eDeltax = (1/2) a t^2 + v_(0)te% Solving for acceleration would yield: %ea = 2(Deltax)/t^2e% since %ev_(0)e% is zero %ea = 2(30 m)/(5 s)^2 = 2.4e%%em/s^2e%";
I want to extract everything between the %e and e% using preg_match_all() but I don't do good with regular expressions - what would you do? I can perform this task using strlen(), strpos() and strtr() but this seems like terrible overkill
$eq = "If the bobsled has to go 30 meters in 5 seconds starting from rest, then I think we could find the acceleration using: %eDeltax = (1/2) a t^2 + v_(0)te% Solving for acceleration would yield: %ea = 2(Deltax)/t^2e% since %ev_(0)e% is zero %ea = 2(30 m)/(5 s)^2 = 2.4e%%em/s^2e%";
I want to extract everything between the %e and e% using preg_match_all() but I don't do good with regular expressions - what would you do? I can perform this task using strlen(), strpos() and strtr() but this seems like terrible overkill