I'm very poor with regexps but this should be very simple for someone who knows regexps.
Basically I will have a string like this:
<if>abc <else>xyz
I would like a regexp so if the string contains <if> <else>
, it splits the string into two parts and returns the two strings after <if>
and <else>
. In the above example it might return an array with the first element being abc
, second xyz
. I'm open to approaches not using regexps too.
Any thoughts?