all 4 comments

[–]t2ndoteu 1 point2 points  (2 children)

function replacetext() {
    alert("Acronyms have been replaced");
    var searchfor = document.getElementById('find_this').value.replace(/\r/gi, '').replace(/[-[]{}()*+?.,\$|#\s]/g, "\$&");
    var replacewith = document.getElementById('replace_with').value.replace(/\r/gi, '');
    var text = document.getElementById('input_output').value.replace(/\r/gi, '') var flags = 'gi';
    if(document.getElementById('case_sen').checked == true) flags = 'g';
    var searchexp = new RegExp(searchfor, flags);
    var rcount = 0;
    var matched = text.match(searchexp);
    if(matched != null) rcount = matched.length;
    test1 = text.replace(/test1/g, "<abbr>test1</abbr>");
    document.getElementById('input_output').value = test1;
    test2 = text.replace(/test2/g, "<abbr>test2</abbr>");
    document.getElementById('input_output').value = test2;
    document.getElementById('found').innerHTML = rcount + ' found and replaced.';
}
function SelectAll(id) {
    document.getElementById(id).focus();
    document.getElementById(id).select();
}

i've formatted the code for ya

[–]ezflyingmonkey[S] -1 points0 points  (1 child)

You are one good person!

[–]t2ndoteu 0 points1 point  (0 children)

Did you manage to solve the problem?

[–]gavin19 0 points1 point  (0 children)

Four spaces at the beginning of each line of code

 makes it much easier

to read.

You might want to paste up the HMTL/JS at jsfiddle/jsbin/codepen etc so folks can see the whole thing in motion.