It works great.. but that regular expression.. Jesus Christ.. Is there a way to dumb that down for me so that i can apply it to other situations, or would that take a complete O'Reilly book to figure out?$A = -4; $w = 500; then $re = '/^\s*(\Q$A\E\s*\*?\s*\Qcos\E\s+\Q$w\E\s*\Qt\E\s+\QA\E||\Q$A\E\s*\*?\s +*\Qcos\E\s*\(\s*\Q$w\E\s*\Qt\E\s*\)\s+\QA\E)\s*$/'; will accept answers in the following form: -4cos 500t A -4 cos 500t A -4*cos 500t A -4*cos(500t) A -- and any number of spaces before and after *, t, ( +and )
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |