tehehodi
12-09-2015, 09:36 AM
I need some help with the beep booping. I figured I can probably reach more nerds on here than my facebook. Maybe we can use this thread as a "I got a BSOD on such and such device because I watch too many adult films online" type of thread. Anyway, here we go...
JAVASCRIPT/REGEX NERDS! I need help with executing a regexp using the exec() method. I get an SyntaxError: invalid regexp group.
<script>
function regPatExample(){
//The address I'm trying to sift through: file:///C:/Users/test/Documents/School/Web%20Design%20and%20Implementatin/Assignments/result.html?firstname=testies&lastname=mctesticles
var address = window.location;
var regFirstName = /(?<==)(.*)(?=&)/;
var regLastName = /(?<=lastname=)(.*)/;
document.getElementById("firstname").value = regFirstName.exec(address);
document.getElementById("lastname").value = regLastName.exec(address);
}
</script>
When I put the address into my text editor(sublime text), I am able to use the regexp and it matches correctly.
JAVASCRIPT/REGEX NERDS! I need help with executing a regexp using the exec() method. I get an SyntaxError: invalid regexp group.
<script>
function regPatExample(){
//The address I'm trying to sift through: file:///C:/Users/test/Documents/School/Web%20Design%20and%20Implementatin/Assignments/result.html?firstname=testies&lastname=mctesticles
var address = window.location;
var regFirstName = /(?<==)(.*)(?=&)/;
var regLastName = /(?<=lastname=)(.*)/;
document.getElementById("firstname").value = regFirstName.exec(address);
document.getElementById("lastname").value = regLastName.exec(address);
}
</script>
When I put the address into my text editor(sublime text), I am able to use the regexp and it matches correctly.