|
I found a regular expression that seems to work when I test it out using this page: http://tools.netshiftmedia.com/regexlibrary/ But when I try to use it in my script, I'm getting an error. What am I doing wrong? Here is my code: code:
edit: long line broken up to prevent page breaking, the actual code does not have the line broken up
|
# ¿ Mar 4, 2008 07:45 |
|
|
# ¿ Apr 29, 2024 06:45 |
|
Avenging Dentist posted:You need to surround the regex with slashes, like you would in Perl. Why waste time writing a complicated function when you can just find a regex via google and plop it in? edit: by the way, adding slashes doesn't fix it either. I'm now getting an "unterminated regular expression literal" error. I've now tried 3 or 4 different regex's I've found with Google, and they either give me a syntax error, or they parse fine, but return false every time. this is starting to piss me off. nbv4 fucked around with this message at 18:43 on Mar 4, 2008 |
# ¿ Mar 4, 2008 18:03 |
|
6174 posted:Avenging Dentist didn't suggest adding backslashes. He suggested slashes, aka forward slashes. gah, I have a habit of calling either back slashes or front slashes "backslashes". I tried adding front slashes and it gave me the "unterminated regular expression literal" error. Backslashes gave me a syntax error.
|
# ¿ Mar 4, 2008 18:42 |
|
Avenging Dentist posted:It works fine for me. You're doing the following right? this is the exact error I get. And here is the top few lines of my code: code:
|
# ¿ Mar 4, 2008 20:54 |
|
Avenging Dentist posted:Get rid of the newlines in the regex (obviously don't do this in the post ). aw super, that did the trick. I feel dumb now.
|
# ¿ Mar 4, 2008 21:19 |
|
I have a form on a webpage that has like 50 checkboxes. I'm using a javascript function to validate the form. I'm trying to formulate an IF statement that returns true if there are more than one of those boxes checked. I'm thinking the XOR operator would be best in this situation, but apparently javascript doesn't have a xor operator... This is what I'm kind of wanting to do:code:
I found this page, which talks about this issue, but it quickly degrades into moon language with exclamation marks and carrots everywhere. Whats the cleanest way to do this?
|
# ¿ Apr 5, 2008 08:20 |
|
Is there an easy way to debug javascript on IE? My site works fine in mozilla browsers, but literally none of the javascript functions work in IE. All IE gives me is a vague "invalid argument" type error which makes it hard to figure out whats wrong.
|
# ¿ Apr 13, 2008 20:55 |
|
fletcher posted:IE8 has a development mode that is like a lovely version of Firebug. You can also emulate IE7 with it. Is the the only way? How do people debug JavaScript from within a UNIX environment?
|
# ¿ Apr 14, 2008 19:40 |
|
Avenging Dentist posted:Does anyone in the world actually do web development exclusively in UNIX? I do all my programing in Ubuntu. Every few days I'll load my stuff onto my laptop which runs XP too see how it looks, which is kind of a pain. I came across that script debugger, but I'm not about to pay hundreds of dollars to buy Office, just for that one tiny application.
|
# ¿ Apr 14, 2008 19:47 |
|
Can someone explain to me the purpose of putting "java script:" at the begining of a function when running a javascript function from within html? For instance:code:
|
# ¿ Apr 26, 2008 04:46 |
|
code:
|
# ¿ Dec 5, 2008 13:37 |
|
I have this simple problem that I just can't figure out. I have a 256 square pixel image. The left and right borders corresponds to a longitude value, and the top abd bottom edge corresponds to a lattitide value. Basically the 256 square image is a rectangle laid onto a map. If you have a lat/long value that lied inside the rectangle, how do you get the pixel coordinates of that point? I've been messing with this all morning, but I just can't seem to find a formula that works.
|
# ¿ May 29, 2009 03:57 |
|
Avenging Dentist posted:
the only problem is that doesn't even begin to work anywhere but the north eastern hemisphere.
|
# ¿ May 29, 2009 05:17 |
|
nevermind
nbv4 fucked around with this message at 07:04 on May 29, 2009 |
# ¿ May 29, 2009 05:57 |
|
rjmccall posted:Do you have some sort of misplaced fetish for abs? I have no idea what you think you're doing with that calculation. code:
|
# ¿ May 29, 2009 08:08 |
|
nm
nbv4 fucked around with this message at 03:07 on Jun 27, 2009 |
# ¿ Jun 26, 2009 00:12 |
|
A long time ago I read about this method where you can store many boolean values as an integer value by multiplying a bunch of prime numbers together. Does anyone know what this method is called? For instance if you want to store a=true b=false c=false d=true e=true you go: a=2 b=3 c=5 d=7 e=11 a * d * e = 2 * 7 * 11 = 154 then to go back to booleans, you factor the number and get: 2*7*11 which correlates to a=true, d=true, e=true Whats this method called?
|
# ¿ Aug 1, 2009 18:44 |
|
Dijkstracula posted:I don't know the name of such a thing, but why on earth would you want to use that instead of a bit field? Suddenly extracting values becomes Hard-With-A-Capitol-H rather than a simple mask and shift. Instead of creating a table in my database with a bunch of boolean columns, I can store all the information in one bigint. This way if I want to add a new boolean, instead of creating a new column in my table, I can just factor in a new prime. The only problem is that it would probably overflow the integer after so many primes... The method I remember reading about may have used addition, because I remember it being used with like 40 different booleans. nbv4 fucked around with this message at 21:07 on Aug 1, 2009 |
# ¿ Aug 1, 2009 21:04 |
|
whats a good 'turnkey' blog hosting service for a programming blog? I want something that I don't have to host myself, and can do things like syntax highlighting out of the box.
|
# ¿ Aug 17, 2010 09:08 |
|
|
# ¿ Apr 29, 2024 06:45 |
|
Can anyone recommend me a good postal address verification service? I want to be able to enter an address, and have it return True or False depending on whether the address is in the postal database. Bonus points if it will return a 'cleaned' version of the data passed in if it is slightly off. I've tried CDYNE, but it sucks. Google has a geocoder, but the terms disallow usage outside of a google maps applet.
|
# ¿ Nov 25, 2010 01:10 |