Link to home
Start Free TrialLog in
Avatar of EffinGood
EffinGoodFlag for United States of America

asked on

REGEX Help - How Do I Do this?

I want to find the following using a regex, how do I do this?
here is some text { best | worst | most awesome} here is some text

Open in new window


I am looking to take the words out of the {} and push them into an array in php. So my end result will be :
array("best", "worst", "most awesome")

Open in new window


I know how to make an array in php, I'm just not sure how to code up the regex part. I want to specifically look for the pipes in the string between the two curly braces, so something like {my words} would not be found but {my | words} would be.
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of EffinGood

ASKER

If I could give you an A+++++, I would! Thanks Ray, you rock.
Glad to help, but as is often the case, the devil is in the details with something like this.  Probably wise to set up as many comprehensive test cases as you can!
https://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_7830-A-Quick-Tour-of-Test-Driven-Development.html

Best of luck with your project!