In an input field I have the value A=123 and I need the JavaScript code to get only the 123 part.
This is what I tried so far:
function formAnswer() {
var input = document.getElementById('given').value;
var match = input.match(/A=.*/);
document.getElementById('result').value = match;
}
<input type="text" id="given" placeholder="Given" value="A=123"/>
<input type="text" id="result" placeholder="Result"/>
<input type="button" value="Click!" onClick="formAnswer();"/>
But this still gets the value A=123. What am I doing wrong here?
^A=(\d+)$See regex101.com/r/6FuzJR/1