Question:
regular expressions php?
Aaron
2010-09-21 09:41:24 UTC
Ok so I have a possibility of having someone enter a calculation like so:

(x+5)/y

or even just an even more simpler one such as 6+5

How would I use a regular expression check on these in PHP?
Three answers:
2010-09-22 17:01:17 UTC
This has nothing to do with regular expressions. regex/preg are used to compare an expression, with a string. So lets say you had the string "hello there", and you have the preg expression "/^hello ([a-z]*)$/". That would return an array(0=> "hello there", 1 => "there");



It looks like you are searching for a PHP equation solver.
2016-10-13 06:59:53 UTC
that's annoying, evaluate writing a loop that loops the string one-via-one, that could desire to strengthen a intensity counter via one if it met a [ and decrease it via one if it met a ] and cut up the string if it met a ] on an identical time as its counter is a million
Web Programmer
2010-09-21 10:53:18 UTC
What is it exactly that you want to check?


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...