markvaughn2006 Posted February 11, 2010 Share Posted February 11, 2010 I can't figure this out.. How would I make the below text (the directions) display: 66t 329p 235 Kansas City 52t 443p 18t 44p 347 Warrenton The below text is what I want to manipulate..(basically I want to capture everything inside the curly brackets and get rid of everything else) Mile Instruction Summary: 472.6 miles (8 hours, 12 minutes) 0.0 Depart Omaha on Capitol Ave (East) 0.1 Turn LEFT (North) onto N 16th St 0.3 Turn RIGHT (East) onto Chicago St 0.4 Take Ramp onto I-480 [Gerald R Ford Fwy] 1.2 Entering Iowa 1.5 Turn RIGHT onto Ramp 1.6 Take Ramp (RIGHT) onto I-29 4.6 At exit 1B, turn RIGHT onto Ramp 4.8 Turn LEFT (North) onto S 24th St 5.4 Turn RIGHT (East) onto 23rd Ave 5.5 Turn LEFT (North) onto Local road(s) 5.5 Arrive {66t} [51501] 5.5 At {329p} [51501], stay on Local road(s) (South) 5.6 Turn RIGHT (West) onto 23rd Ave 5.7 Turn LEFT (South) onto S 24th St 6.3 Take Ramp (LEFT) onto I-29 [i-80] 57.0 Entering Missouri 136.8 At exit 44, turn RIGHT onto Ramp 137.0 Turn LEFT (East) onto I-29 Bus [uS-169] 137.0 Road name changes to US-169 138.7 Turn LEFT (North) onto Riverside Terrace SE 139.3 Turn RIGHT (East) onto Saxton Easton Rd SE 140.5 Turn LEFT (North) onto Local road(s) 141.0 At {235} [64507], return South on Local road(s) 141.4 Turn RIGHT (West) onto Saxton Easton Rd SE 142.6 Turn LEFT (South) onto Riverside Terrace SE 143.2 Turn RIGHT (West) onto US-169 144.9 Road name changes to I-29 Bus [uS-169] 144.9 Take Ramp (LEFT) onto I-29 [uS-71] 191.0 At exit 6A, take Ramp (RIGHT) onto Armour Rd 191.3 Road name changes to SR-210 [Armour Rd] 192.5 Turn RIGHT onto Ramp 192.7 Take Ramp (RIGHT) onto NE Chouteau Trafficway 194.2 Turn LEFT (East) onto E Front St 194.7 Turn LEFT (North) onto N Topping Ave 194.8 Turn RIGHT (East) onto E Connecticut Ave 195.0 Turn RIGHT (South) onto Local road(s) 195.1 At {Kansas City} [64120], return North on Local road(s) 195.1 Turn LEFT (West) onto E Connecticut Ave 195.3 Turn LEFT (South) onto N Topping Ave 195.5 Turn LEFT (East) onto E Front St 196.3 Take Ramp (RIGHT) onto I-435 200.7 At exit 63B, take Ramp (LEFT) onto I-70 [George Brett Super Hwy] 221.0 At exit 28, turn RIGHT onto Ramp 221.2 Turn LEFT (North) onto SR-F [sR-H] 221.3 Road name changes to SR-H [N Broadway St] 222.0 Turn LEFT (West) onto E Jim Owens Rd 223.1 Turn LEFT (South) onto Local road(s) 223.3 At {52t} [64075], return North on Local road(s) 223.4 Turn RIGHT (East) onto E Jim Owens Rd 224.5 Turn RIGHT (South) onto SR-H [N Broadway St] 225.2 Road name changes to SR-F [sR-H] 225.3 Take Ramp (LEFT) onto I-70 [uS-40] 246.3 At exit 49, turn RIGHT onto Ramp 246.5 Turn LEFT (North) onto SR-13 250.0 Turn RIGHT (East) onto Mt Moriah Rd 251.0 Turn LEFT (North) onto Shelby Rd 251.7 Road name changes to Shelby St 251.7 Turn LEFT (West) onto Local road(s) 251.8 At {443p} [64037], return East on Local road(s) 251.9 Turn LEFT (North) onto Shelby St 252.5 Turn RIGHT (East) onto SR-T [E 26th St] 252.7 Keep STRAIGHT onto SR-T 257.3 Keep STRAIGHT onto SR-T [1st St] 257.7 Keep STRAIGHT onto SR-T 259.3 Road name changes to Blue Jay Rd 259.4 Turn LEFT (East) onto Old Highway 40 261.9 Turn LEFT (North) onto CR-263 [MO-KK] 262.0 Turn RIGHT (East) onto Mulkey Station Rd 263.0 Turn RIGHT (South) onto Zoar Rd 263.8 Turn RIGHT (South) onto Cooks Store Rd 264.3 Turn LEFT (East) onto Local road(s) 264.6 At {18t} [64020-0745], return West on Local road(s) 264.9 Turn LEFT (South) onto Cooks Store Rd 265.5 Turn LEFT (East) onto Minuteman Rd 267.8 Turn LEFT (North) onto SR-23 268.5 Keep STRAIGHT onto SR-23 [s Main St] 269.8 Keep STRAIGHT onto SR-23 [N Main St] 270.0 Take Ramp (RIGHT) onto I-70 [uS-40] 314.7 At exit 103, turn RIGHT onto Ramp 314.9 Turn RIGHT (South) onto SR-B 317.2 Turn RIGHT (West) onto Local road(s) 317.3 Turn RIGHT (North) onto Local road(s) 317.5 Arrive {44p} [65233] 317.5 At {347} [65233], stay on Local road(s) (South) 317.7 Turn LEFT (East) onto Local road(s) 317.9 Turn LEFT (North) onto SR-B 320.1 Take Ramp (RIGHT) onto I-70 404.7 At exit 188, turn RIGHT onto Ramp 404.9 Turn RIGHT (South-West) onto SR-B 406.5 Keep STRAIGHT onto MO-Ee 407.1 Turn LEFT (South) onto Pendleton Lost Creek Rd 408.0 Turn LEFT (East) onto Local road(s) 408.0 Bear LEFT (North-East) onto Local road(s) 408.1 Turn RIGHT (East) onto Local road(s) 408.2 At {Warrenton} [63383], return West on Local road(s) 408.2 Turn LEFT (South) onto Local road(s) 408.4 Bear RIGHT (West) onto Local road(s) 408.4 Turn RIGHT (North) onto Pendleton Lost Creek Rd 409.3 Turn RIGHT (East) onto MO-Ee 409.9 Keep STRAIGHT onto SR-B 411.4 Take Ramp (RIGHT) onto I-70 [uS-40] 432.9 At exit 210A, take Ramp (RIGHT) onto US-40 [uS-61] 442.9 At exit 9, road name changes to I-64 [uS-40] 470.9 At exit 37A, turn RIGHT onto Ramp 471.0 Road name changes to Market St 472.3 Turn RIGHT (South) onto S 21st St 472.5 Turn RIGHT (West) onto Local road(s) 472.6 Arrive St. Louis SUMMARY Driving distance: 472.6 miles Trip duration: 8 hours, 12 minutes Driving time: 8 hours, 12 minutes Cost: $68.27 Quote Link to comment https://forums.phpfreaks.com/topic/191787-stuck/ Share on other sites More sharing options...
abazoskib Posted February 11, 2010 Share Posted February 11, 2010 You don't need a regex. Use strpos and substr Quote Link to comment https://forums.phpfreaks.com/topic/191787-stuck/#findComment-1010939 Share on other sites More sharing options...
markvaughn2006 Posted February 11, 2010 Author Share Posted February 11, 2010 cool thanks, i'll give it a shot! Quote Link to comment https://forums.phpfreaks.com/topic/191787-stuck/#findComment-1010961 Share on other sites More sharing options...
sader Posted February 11, 2010 Share Posted February 11, 2010 preg_match_all('/\\{(.*?)\\}/im', $str, $result, PREG_PATTERN_ORDER); for ($i = 0; $i < count($result[0]); $i++) { echo $result[1][$i]."<br />"; } Quote Link to comment https://forums.phpfreaks.com/topic/191787-stuck/#findComment-1011000 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.