Regex - Help with loop
In case i have a string
PHP Code:
I tried the following regex pattern , guess what no success PHP Code:
PHP Code:
I had try using 's' flag , no success . All i get is "str1" as the output |
Re: Regex - Help with loop
How are you reading the output? Do the words between the dashes contain anything else than letters and numbers?
|
Re: Regex - Help with loop
You might also be interested in the str_explode function from this inc: https://forums.alliedmods.net/showthread.php?t=163205
|
Re: Regex - Help with loop
Use Explode function from php ;p
Code:
|
Re: Regex - Help with loop
I just a need a solution for regex , please stick regex .
|
Re: Regex - Help with loop
Quote:
|
Re: Regex - Help with loop
Nope just a '-' , i tried every possibilities even including white spaces in my pattern and string . The output string is actually read out from a file . Is regex too limited ?
Just detect str and push them all to array , would be very helpful :D PHP Code:
|
Re: Regex - Help with loop
I might be blanking out here but I think this is the only way:
Code:
|
Re: Regex - Help with loop
Okay , but i expected regex to do it without loop or somethig , anyways thanks
|
Re: Regex - Help with loop
You should be able to do it with submatches but you still need a loop to loop through the submatches.
Code:
^([^-]*)-([^-]*)-([^-]*)-([^-]*)$Code:
^(\w*)-(\w*)-(\w*)-(\w*)$ |
| All times are GMT -4. The time now is 21:11. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.