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.
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
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


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!

Best of luck with your project!