Welcome Guest, Not a member yet? Register   Sign In
regex help needed
#2

(05-09-2016, 09:54 AM)cupboy Wrote: I've been trying to figure this out for awhile, so it must be time to ask for help. How can I get the results I want?

Code:
$subject = '\n   MC - 5-10 OVER IN A CHURCH ZONE    - 12/08/15\n    INF - 1-5 OVER IN A SCHOOL ZONE    - 12/14/15\n';

$matches = preg_split('/ ([MF].|INF|CAP) \-(.*) \- /',$subject, NULL); // also tried: preg_match, preg_match_all
// desired result: 2 string values placed into array
// 1. MC - 5-10 OVER IN A CHURCH ZONE    -
// 2. INF - 1-5 OVER IN A SCHOOL ZONE    -

is the information you're going to be getting always in this format?
Codeigniter is simply one of the tools you need to learn to be a successful developer. Always add more tools to your coding arsenal!
Reply


Messages In This Thread
regex help needed - by cupboy - 05-09-2016, 09:54 AM
RE: regex help needed - by albertleao - 05-09-2016, 10:40 AM
RE: regex help needed - by Wouter60 - 05-09-2016, 11:06 AM
RE: regex help needed - by InsiteFX - 05-09-2016, 12:43 PM
RE: regex help needed - by cupboy - 05-09-2016, 11:09 PM



Theme © iAndrew 2016 - Forum software by © MyBB