I need a regular expression, which String.matches() should return true for below strings:

```
x
y
x < y
5 < ab
xyz + abc < 5 * yz
y = 6
```

And should false for below strings:

```
x5 == 3
y = 3yd
x < 5 < 3
5 <+ ab
xyz + 5 < f5 * yz
```

I tried the following code but didn't worked.

```
public boolean isExpr(String line) {
// factor = ([A-Za-Z]+|[0-9]+) for example: aasdaa or 23131 or xyz or 1 or a
// simple-expr = (factor {mulop factor} {addop factor {mulop factor}})
// expr = simple-expr compop simple-expr | simple-expr
String factor = new String("([A-Za-z]+|[0-9]+)");
String mulOp = new String("(\\*|\\/)"); // '*'' or '/'
String addOp = new String("(\\+|\\-)"); // '+' or '-'
String compOp = new String("(\\<|\\=)"); // '<' or '='
String simpleExpr = new String("(" + factor + " (" + mulOp + " " + factor + ")? (" + addOp + " " + factor + " (" + mulOp + " " + factor + ")?)?)");
String expr = new String("(" + simpleExpr + " " + compOp + " " + simpleExpr + ")|" + simpleExpr);
System.out.println(line.matches(expr));
return line.matches(expr);
}
```

Expression(expr) is below

```
expr = simple-expr compop simple-expr | simple-expr
```

Related expressions are:

```
simple-expr = factor {mulop factor} {addop factor {mulop factor}}
factor = [A-Za-Z]+|[0-9]+
```