The regex needed depends on how the formula is laid out and whether you want to capture anything.
If it is in that same format everytime and you don't want to capture specific parts then sometime like this should work:
Code:
if ($string =~ m!
\$[a-z] # Something like $a or $b etc.
\s* # Optional space.
[+/\*%-] # Multiplication, addition, subtraction etc...
\s* # Optional space.
[a-z]+ # cos, sin, min etc.
\( # Argument bracket.
[a-z\$,\s]+ # Arguments such as $a, $b, $c etc.
\) # Closing argument bracket.
!xsg) {
print "Got a match!\n";
}