Hmm, a little bit of a different responce than I expected, I guess I should have made myself more clear.
What I really needed was a exp that found certain strings, in which some places are allowed spaces, and some places aren't. For example:
Code: Select all
A test equation to find ((12/15)*("pie")/("diameter"-8)+("circumfrance"*2.5)) a answer to a equation I just made up on the spot.
And the exp I am currently using:
Code: Select all
#\([\w\W]*?((?:\([\w\W]*?\)).*?){0,}\)#
Which finds:
Code: Select all
Array
(
[0] => Array
(
[0] => ((12/15)*("pie")/("diameter"-8)+("circumfrance"*2.5))
)
[1] => Array
(
[0] => ("circumfrance"*2.5)
)
)
Which is perfect for [0][0]. However, I am now stuck with the bit where you can have spaces inbetween the quotes, but nowhere else in the equation, so:
Code: Select all
Would NOT be accepted as it has spaces outside of the quotes:
( ( 12 / 15 ) * ( "pie" ) / ( "diameter" - 8 ) + ( "circumfrance" * 2.5 ) )
Would be accepted as there are no outside spaces, save for inbetween the quotes:
((12/15)*("pie")/("dia me t er"-8)+("ci rc umf ra nce"*2.5))
Let me just remind you that it needs to all be in the regex expression with no outside PHP help (unless it is absolutely necessary!).
Hope I'm not loosing you.
Thanks.