Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

PHP and Regular Expressions

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

Name: Anonymous 2007-06-15 14:56 ID:kQPwzXix

>>2
close - my first guess was /%e*e%/ but that returned empty - your %e(.*?)e% kind of worked, but it need to be

'/%e(.*?)e%/' - now can someone tell me why '(.*?)' works but not '*'?

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List