$(document).ready(function () {
$('button').click(function () {
var equation = $('#equation').val();
var split = equation.match(/[-+]?\d+[?xy]/g);
alert(split);
var matches = equation.match(/-?\b\d+\b/g);
$('#super').text(split + ',' + matches);
var ncc = $('#super').text();
var res = ncc.split(/[,]/g);
});
});

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
<script src="linear.js"></script>
<input type="text" value ="x3+2x2-4y-1=0" id="equation">
<button>solve</button>
<p id="super"></p>
&#13;
如何在rejax中拆分等式,例如x square(x2)
,x cube (x3)
在任何等式中将x
和幂值拆分为拆分。
该等式x3 + 2x2 - 4y - 1 = 0
如何拆分请帮助我改进此代码。