MitsuStyle MitsuStyle

Go Back   MitsuStyle > The Homefront! > The Parking Lot - On & Off Topic

Reply
 
Thread Tools Display Modes
Old 12-09-2015   #1
tehehodi
Braaaaaaaap!
 
tehehodi's Avatar
 

Join Date: Dec 2008
Location: Fridley
Drives: '09 Silveraydo
Posts: 2,028
Send a message via AIM to tehehodi
Computer haaaaalps

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.

Last edited by tehehodi; 12-09-2015 at 09:43 AM..
tehehodi is offline   Reply With Quote
Old 12-09-2015   #2
tehehodi
Braaaaaaaap!
 
tehehodi's Avatar
 

Join Date: Dec 2008
Location: Fridley
Drives: '09 Silveraydo
Posts: 2,028
Send a message via AIM to tehehodi
Re: Computer haaaaalps

Apparently, Javascript doesn't support positive lookbehind. So this was devised with some help:

regFirstName = /(?==(.+)&)/;
regLastName = /(?=lastname=(.+))/;

but now I'm getting a comma such as ",testies" and ",mctesticles"
tehehodi is offline   Reply With Quote
Old 12-09-2015   #3
polishmafia
Smells like cat poop
 
polishmafia's Avatar
 

Join Date: Feb 2007
Location: maple grove
Drives: an evo's fat korean cousin
Posts: 2,549
Re: Computer haaaaalps

What does the data look like in your file? How is it formatted?
__________________
Speaking about wanting kids...
turbotalon1g: 3 max, she wants one of each.
A////guy: "we are shooting for a transgender child this time"
polishmafia is offline   Reply With Quote
Old 12-09-2015   #4
turbotalon1g
 
turbotalon1g's Avatar
 

Join Date: Mar 2005
Location: Blaine, MN
Drives: '91 Automagic
Posts: 13,908
Send a message via AIM to turbotalon1g
Re: Computer haaaaalps

I wanna make 100k. Tags few on this thread
__________________
Aaron/brownman/big brown.
'91 Automagic.
'02 Z06
Please leave feedback - http://www.dsmtuners.com/forums/itrader.php?u=58309
turbotalon1g is offline   Reply With Quote
Old 12-09-2015   #5
tehehodi
Braaaaaaaap!
 
tehehodi's Avatar
 

Join Date: Dec 2008
Location: Fridley
Drives: '09 Silveraydo
Posts: 2,028
Send a message via AIM to tehehodi
Re: Computer haaaaalps

Quote:
Originally Posted by polishmafia View Post
What does the data look like in your file? How is it formatted?
It's suppose to search that "string" which is a URL that is commented out, nested inside of the script tags.

address = "file:///C:/Users/test/Documents/School/Web%20Design%20and%20Implementatin/Assignments/result.html?firstname=testies&lastname=mctesticles ";
tehehodi is offline   Reply With Quote
Old 12-09-2015   #6
polishmafia
Smells like cat poop
 
polishmafia's Avatar
 

Join Date: Feb 2007
Location: maple grove
Drives: an evo's fat korean cousin
Posts: 2,549
Re: Computer haaaaalps

Right. I need to see a sample of the file it is supposed to parse.

I think the code is good, but it may be the file layout.
__________________
Speaking about wanting kids...
turbotalon1g: 3 max, she wants one of each.
A////guy: "we are shooting for a transgender child this time"
polishmafia is offline   Reply With Quote
Old 12-10-2015   #7
tehehodi
Braaaaaaaap!
 
tehehodi's Avatar
 

Join Date: Dec 2008
Location: Fridley
Drives: '09 Silveraydo
Posts: 2,028
Send a message via AIM to tehehodi
Re: Computer haaaaalps

It's not actually searching a file though. So I don't know what you mean? It's searching that specific string. Not the file. The file is the path to a results page of a query. The query submits as a GET method(which yes, isn't safe) but it's part of an exercise. It's suppose to grab the first name value and last name value and put those in a read only text box on a results page. Sorry if I didn't word all that correctly.

Regexp regardless of format should pick it out assuming the pattern is correct. At least, that's my understanding.
tehehodi is offline   Reply With Quote
Old 12-10-2015   #8
A//// Guy
 
A//// Guy's Avatar
 
Bloody Seal Bounce Champion!
Join Date: Oct 2003
Location: South Burbs
Drives: Slowly
Posts: 9,870
Re: Computer haaaaalps

A//// Guy is offline   Reply With Quote
Reply

Tags
aimhigherbruh, beep, boop, ialreadymake100k, javascripts, make100ktoday, nerd, some alien ass language, virgin talk


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT -5. The time now is 07:41 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.