Kyleva2204
09-04-2008, 05:58 PM
Ok, so maybe this can be done with out regular expressions but explode() does not work.. Here is my problem.. I have a string like so:
/one/2//3/4//5///b/
and I want to be able to match everything in between the slashes.. wether it have content or not. I have tried explode('/',$my_string); but not only does that ignore the blanks, but it also makes an extra array item if it has the ending /. I have tried using regular expressions and preg_match_all, but with no real luck. I could easily get it to match ending the ending slash or not (it won't always be there).. I just need some help getting my expression to match the blank lines..
Heres what I have tried, any help would be great :).
preg_match_all('!(.*|^$)/!U',$string,$array);
On second thought, if someone could help me try and get it to work with or without the ending slash, that would be cool too :).
/one/2//3/4//5///b/
and I want to be able to match everything in between the slashes.. wether it have content or not. I have tried explode('/',$my_string); but not only does that ignore the blanks, but it also makes an extra array item if it has the ending /. I have tried using regular expressions and preg_match_all, but with no real luck. I could easily get it to match ending the ending slash or not (it won't always be there).. I just need some help getting my expression to match the blank lines..
Heres what I have tried, any help would be great :).
preg_match_all('!(.*|^$)/!U',$string,$array);
On second thought, if someone could help me try and get it to work with or without the ending slash, that would be cool too :).