Answer the question
In order to leave comments, you need to log in
What is the best way to write a regular expression?
Hello.
There is the following line
"$cond($eq($HND,1),0.85*($m1*1.2*1.03*$MWS/100)+0.03*($MW+$mw)/2-1,1.2*($m1*1.2*1.03*$MWS/100)+0.03*($MW+$mw)/2+1)"
Array(
[0] => array(
[0] => '$cond',
[1] => '$eq($HND,1)',
[2] => '0.85*($m1*1.2*1.03*$MWS/100)+0.03*($MW+$mw)/2-1,1.2*($m1*1.2*1.03*$MWS/100)+0.03*($MW+$mw)/2+1'
),
[1] => array(
[0] => '$eq',
[1] => '$HND',
[2] => '1'
)
Answer the question
In order to leave comments, you need to log in
Considering that other functions can be arguments, there is little you can do here with regular expressions (by the way, in your example Array[0][2] is not correct, since, logically, the string
should have gone to Array[0][3 ] as the third argument of the function)
Such a problem could be solved by the following algorithm:
It can be implemented both with recursion and with a simple loop. It seems that he painted everything intelligibly and did not miss anything
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question