I am creating online Regex to find and replace web pages. But It doesn't replace anything.
Index.html
<input type="text" id="textInput"></textarea>
<input type="text" id="find"></textarea>
<input type="text" id="replace"></textarea>
<button id="button"> Submit </button>
Replacer.js
$( document ).ready( function() {
$("#button").on( 'click', function(){
var textInput = $("#textInput").val();
var find = $("#find").val();
var replace = $("#replace").val();
var newText = textInput.replace( /find/, replace );
console.log( newText );
})
})
Text= 2019, find= (\d{4}) , replace= J $1
I am expecting J 2019 in the console. But I am getting 2019.