Raised This Month: $ Target: $400
 0% 

Regex - Help with loop


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
...
Junior Member
Join Date: Jun 2014
Old 06-22-2014 , 08:45   Regex - Help with loop
Reply With Quote #1

In case i have a string
PHP Code:
new string[] = "str1-str2-str3-str4" 
I am trying to get those data between'em '-'
I tried the following regex pattern , guess what no success
PHP Code:
(\w+)- 
Second pattern i tried was also a fail.
PHP Code:
((\w+)-)+ 
Can someone write down how to make a regex pattern which will loop throughout the string and get all those data in between '-' , Note - my string can contain any amount of '-' , i already did it using strtok , but now i want it to be done in regex.
I had try using 's' flag , no success . All i get is "str1" as the output

Last edited by ...; 06-22-2014 at 08:50.
... is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 21:11.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode