I am trying to parse a formula structure that I have created. So far It's really close. I just need some help with the regex to split the equal sign out.
Here's the string I'm testing
({1+1=2|2+2=4}+{1+2=3|2+3=5})=16+10
This is the output i'm currently getting
array(6) {
[0]=>
string(1) "("
[1]=>
string(13) "{1+1=2|2+2=4}"
[2]=>
string(1) "+"
[3]=>
string(13) "{1+2=3|2+3=5}"
[4]=>
string(1) ")"
[5]=>
string(6) "=16+10"
}
[EDIT] - Sorry forgot the expression.
$logical_test_parts = preg_split( "/({.+?})([\)|=|\+?])/" , $logical_test, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
the issue I'm having is on index 5.
I need index 5 to be "="
and index 6 to be 16+10
any help is greatly appreciated