• Ryan (unregistered)

    The real wtf here is using regex.

    Nothing as old as regex are can ever be good.

    ;-)

  • Henning Makholm (unregistered)

    But when his old phone broke and he had to transfer the minutes to a new phone,

    Why does he need to interact with the provider for that?

    (1) Open up old phone.

    (2) Retrieve the SIM.

    (3) Insert SIM into new phone.

    (4) Profit?

  • (cs)

    I personally would not want to try writing a regex to validate any email address. Have you seen some of the more interesting ones?

    Here's my favorite:

    (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
  • (cs) in reply to Henning Makholm
    Henning Makholm:
    But when his old phone broke and he had to transfer the minutes to a new phone,

    Why does he need to interact with the provider for that?

    (1) Open up old phone.

    (2) Retrieve the SIM.

    (3) Insert SIM into new phone.

    (4) Profit?

    none of the regular services in the US use SIMs... do the prepaid?

  • John (unregistered) in reply to Kazan

    I just performed said procedure on my wife's (third) V3 Razr. I live in the middle of the US (Missouri).

    I take it from the story, the plain old phone probably does not have a SIM card slot in it.

    For the record I have never sent a text message in my life. (But I do have a fancy phone)

  • me (unregistered)

    TRWTF is not checking for plural when displaying the number of comments:

    [image]

  • Alyson (unregistered) in reply to Kazan

    Depends on the carrier. Anything from T-Mobile or AT&T or one of the sub companies that use their towers would have a SIM. However Verizon, Sprint, US Cellular etc still rely on CDMA for their cellular transmission

  • (cs) in reply to Kazan
    Kazan:
    none of the regular services in the US use SIMs...
    Not true. AT&T and T-Mobile both offer GSM services, complete with SIM cards.
  • Henning Makholm (unregistered) in reply to Kazan
    Kazan:
    none of the regular services in the US use SIMs... do the prepaid?
    Hm, I thought the US had switched to GSM too, years ago (except on a different frequency band from the rest of the world).

    Or do they use special phones that have SIM functionality built-in? If so, WTF?

  • Inhibeo (unregistered) in reply to Henning Makholm
    Henning Makholm:
    But when his old phone broke and he had to transfer the minutes to a new phone,

    Why does he need to interact with the provider for that?

    (1) Open up old phone.

    (2) Retrieve the SIM.

    (3) Insert SIM into new phone.

    (4) Profit?

    Oh, la de da Mr. Frenchman with your "SIM cards" and "GSM" and "phones that work with multiple providers." Here in AMERICA, our providers give us free phones every two years in exchange for never, ever leaving them. We call that COMMITMENT.

  • (cs)

    I'm an American. All of the cell phones I've had over the past six or seven years have had SIM Cards. Yes, both of them.

  • pete (unregistered)
    It’s just a plain old phone with plain old service that can only dial and receive plain old calls. And it’s exactly the type of phone that Jack wants.
    Me too! Whenever I am forced to get a new cell phone, I start off by telling the sales weasel the "features" I don't want. They look at me like I'm speaking binary.

    Guess it's time to head over to net10 and see what they have...

  • (cs)

    Nice to know I'm not the only one with that attitude towards cell phones.

  • Rhywden (unregistered) in reply to durnurd
    durnurd:
    I personally would not want to try writing a regex to validate any email address. Have you seen some of the more interesting ones?

    Here's my favorite:

    (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])

    Could someone explain to me why a simple

    /[a-z._-]+@[a-z.-]+.[a-z]{2,3}/i

    does not suffice? Granted, it does not check if the email adress is actually valid - then again, I'd rather do that with a verification email.

  • Captain Facts (unregistered) in reply to durnurd
    durnurd:
    I personally would not want to try writing a regex to validate any email address.

    Nor should you, when there are existing "solutions". Especially this beauty.

  • Hector (unregistered)

    haha, they also have great comments..

    • Function: MM_findObj
    • @n
    • @d
    • Purpose : Go find the Object elements on the current document
    • I don't really know why the origal code do such a
    • complex logic like this. Could have made it much simpler.
  • me (unregistered) in reply to Rhywden
    Rhywden:
    Could someone explain to me why a simple

    /[a-z._-]+@[a-z.-]+.[a-z]{2,3}/i

    does not suffice?

    http://www.info.info

    also http://haacked.com/archive/2007/08/21/i-knew-how-to-validate-an-email-address-until-i.aspx

  • (cs) in reply to Inhibeo
    Inhibeo:
    Oh, la de da Mr. Frenchman with your "SIM cards" and "GSM" and "phones that work with multiple providers." Here in AMERICA, our providers give us free phones every two years in exchange for never, ever leaving them. We call that COMMITMENT.

    We have a different word for it (says the person who's been with O2 since they were still BT Cellnet).

    Also, I suspect, with a name like Henning Makholm, they're Scandinavian.

  • (cs) in reply to Rhywden
    Rhywden:
    Could someone explain to me why a simple

    /[a-z._-]+@[a-z.-]+.[a-z]{2,3}/i

    does not suffice? Granted, it does not check if the email adress is actually valid - then again, I'd rather do that with a verification email.

    I suppose you wanted something more detailed than "it fails to accept a very large number of valid email addresses". Examples would be those that use + signs in the local part, those that use longer TLDs, those that use IDN in the domain names, etc.

    Of course, there isn't much call for it, but to take it to an extreme...

    "this is " @ valid \\"@[123.123.123.123]

  • Henning Makholm (unregistered) in reply to Rhywden
    Rhywden:
    Could someone explain to me why a simple

    /[a-z._-]+@[a-z.-]+.[a-z]{2,3}/i

    does not suffice?

    It rejects well-formed email addresses such as

    "John Doe"@example.org

    or

    [email protected]

  • Barrett Jacobsen (unregistered) in reply to TarquinWJ

    Great! Now my e-mail address is out there for all to see - time to change it to "this is " @ valid \\"2@[123.123.123.123]

  • Henning Makholm (unregistered) in reply to Barrett Jacobsen
    Barrett Jacobsen:
    Great! Now my e-mail address is out there for all to see - time to change it to "this is \" @ valid \\\\"2@[123.123.123.123]
    Which is, however, not valid.
  • (cs) in reply to Kazan
    Kazan:
    none of the regular services in the US use SIMs... do the prepaid?

    What??? Most phones in the US use SIMs. AT&T does, and I'm pretty sure it's the biggest cell phone company in the US; and then there's all of the companies that lease AT&T towers, and T-Mobile.

  • Anon (unregistered) in reply to pete
    pete:
    It’s just a plain old phone with plain old service that can only dial and receive plain old calls. And it’s exactly the type of phone that Jack wants.
    Me too! Whenever I am forced to get a new cell phone, I start off by telling the sales weasel the "features" I don't want. They look at me like I'm speaking binary.

    Guess it's time to head over to net10 and see what they have...

    Me three! I have Boost mobile. The nice part about their service is that their accounts stay active so long as you buy new minutes every three months. Most other services require you to buy new minutes every month to keep the account open. So, since I only use the phone for emergency use, it only costs $20 every 3 months.

  • (cs)

    They missed at least one bug in verifyEmail: if the string doesn't contain an @ then nIndex and nLastIndex will be the same but strTkn1 will have length one, so they'll try to access and out-of-bounds array index.

  • Romeo (unregistered)

    My parents used to ask me to fix problems with a cell phone my sister gave them. Then I bought a new one and called Verizon and they no longer call me for cell phone suport. Long live Verizon!

  • (cs)

    (Shrugs) I don't know Javascript. Or Regex.

  • Reaver121 (unregistered) in reply to Anon
    Anon:
    pete:
    It’s just a plain old phone with plain old service that can only dial and receive plain old calls. And it’s exactly the type of phone that Jack wants.
    Me too! Whenever I am forced to get a new cell phone, I start off by telling the sales weasel the "features" I don't want. They look at me like I'm speaking binary.

    Guess it's time to head over to net10 and see what they have...

    Me three! I have Boost mobile. The nice part about their service is that their accounts stay active so long as you buy new minutes every three months. Most other services require you to buy new minutes every month to keep the account open. So, since I only use the phone for emergency use, it only costs $20 every 3 months.

    Me four here. When my old phone broke (only calls, SMS and agenda, no color and no camera) I just asked to the sales guy the cheapest phone in the store (29 euros) and even then the thing has some features I won't ever use. I use pre-paid cards which is about 15 euros every 1 to 3 months.

    Even worse, the only reason I have a cell phone is because my father wanted it so for possible emergencies. Work became later the second reason. Without those I would happily chuck the thing into the toilet. I don't really like phoning (doesn't help that I also sometimes stutter) and prefer asynchronous communication.

  • Neil S (unregistered)

    TRWTF is that half this post is just an ad.

    If this becomes a trend I'll probably delete the feed.

  • Jurgen (unregistered) in reply to Reaver121
    Reaver121:
    Anon:
    pete:
    It’s just a plain old phone with plain old service that can only dial and receive plain old calls. And it’s exactly the type of phone that Jack wants.
    Me too! Whenever I am forced to get a new cell phone, I start off by telling the sales weasel the "features" I don't want. They look at me like I'm speaking binary.

    Guess it's time to head over to net10 and see what they have...

    Me three! I have Boost mobile. The nice part about their service is that their accounts stay active so long as you buy new minutes every three months. Most other services require you to buy new minutes every month to keep the account open. So, since I only use the phone for emergency use, it only costs $20 every 3 months.

    Me four here. When my old phone broke (only calls, SMS and agenda, no color and no camera) I just asked to the sales guy the cheapest phone in the store (29 euros) and even then the thing has some features I won't ever use. I use pre-paid cards which is about 15 euros every 1 to 3 months.

    Even worse, the only reason I have a cell phone is because my father wanted it so for possible emergencies. Work became later the second reason. Without those I would happily chuck the thing into the toilet. I don't really like phoning (doesn't help that I also sometimes stutter) and prefer asynchronous communication.

    Bah, I only have to recharge my account every year.

  • Chelloveck (unregistered) in reply to durnurd
    durnurd:
    I personally would not want to try writing a regex to validate any email address.

    Can someone explain to me why anyone even bothers to "validate" an email address on a web form? Even well-formed addresses may not be valid, in that they may point to a fake domain or user. About the only reason I can see for it is to avoid passing absolute crap to a mail bot. Okay, fine, throw out the truly egregious errors. Otherwise, if it's vaguely plausible let it through and assume the mailer will reject anything it can't understand.

    Whenever I run across anything that "requires" an email address but isn't really going to send me anything I need (like a reg key or something) I use "postmaster@{whatever.com}", where "{whatever.com}" is the site asking for the info. Almost always works, and I hope it annoys anyone trying to add me to their mailing list.

  • Dan T. (unregistered)

    I use .name and .info addresses, and I get very annoyed by ineptly-programmed "address validators" that don't like TLDs longer than 3 characters.

  • (cs) in reply to Reaver121
    Reaver121:
    Without those I would happily chuck the thing into the toilet.
    Interestingly, that's exactly what I did with my previous phone. Not on purpose, mind you... hint: don't carry your cell phone in your shirt pocket when using the restroom.
  • configurator (unregistered)

    I guess string concatenation wasn't his thing either - from the sign-in page:

    		if(strPage=="verify_changeEmailPass.jsp")
    		{	
                  		document.frmChangeInfo.action = '/ebiz/jsplib/verify_changeEmailPass.jsp;jsessionid=KR1XTKQ4nGQJGQtQY8KpTGYsGZw5066JLPhPjcnwbqX6VGyx8QLG!-181705677';
     			document.frmChangeInfo.submit() ;
     			
     		}
    		else if(strPage=="verify_sign_in.jsp")
    		{
    			document.frmSignIn.action = '/ebiz/jsplib/verify_sign_in.jsp;jsessionid=KR1XTKQ4nGQJGQtQY8KpTGYsGZw5066JLPhPjcnwbqX6VGyx8QLG!-181705677';
    			document.frmSignIn.submit() ;
     
    		}
    		/* sixteen other options */
    

    And that code repeats twice in two different functions...

  • configurator (unregistered)

    D'oh, didn't notice it was different forms in the ifs.

  • Thg (unregistered)

    me (max(also) + 1).

    another vote for simple mobile phones. I have my pay-as-you-go plan through 7-11

    (which goes over AT&T towers, and uses a SIM)

  • (cs)

    <grammar_nazi> Plain Old Regexes </grammar_nazi>

    FTFY

  • (cs)

    I bought a couple of Net10 phones to use whilst on holiday in the States last year - I don't think they had SIM cards.

    Also, it cost $30 for a phone with $30 of airtime. If you don't care about your number it's worth just replacing both every time you run out.

  • (cs) in reply to Reaver121
    Reaver121:
    I don't really like phoning [...] and prefer asynchronous communication.
    Oh, you should definitely get a Sprint account, then. Almost every call I ever had when I was their customer faded in and out, constantly.
  • (cs) in reply to Reaver121
    Reaver121:
    I don't really like phoning (doesn't help that I also sometimes stutter) and prefer asynchronous communication.

    Likewise, I rarely use my mobile as a phone. I mostly use it for sending SMSs and e-mails because that means I don't have to talk to people - I don't think I've actually used it to make a call for months.

  • (cs) in reply to Kazan
    Kazan:
    Henning Makholm:
    But when his old phone broke and he had to transfer the minutes to a new phone,

    Why does he need to interact with the provider for that?

    (1) Open up old phone.

    (2) Retrieve the SIM.

    (3) Insert SIM into new phone.

    (4) Profit?

    none of the regular services in the US use SIMs... do the prepaid?

    I guess TMobile and the rest of the GSM/GPRS service providers aren't regular services? ... as far as I know, only Verizon doesn't use SIMs. Even my Cingular (now AT&T) prepaid phone used SIMs, though the phone was of course locked to Cingular since it cost $10 and was thus heavily subsidized. Now that I'm no longer their customer I really should get them to unlock it for me...

  • Anon (unregistered) in reply to Code Dependent
    Code Dependent:
    Reaver121:
    Without those I would happily chuck the thing into the toilet.
    Interestingly, that's exactly what I did with my previous phone. Not on purpose, mind you... hint: don't carry your cell phone in your shirt pocket when using the restroom.

    I won't ask what you where doing in the restroom that caused a phone from your shirt pocket to end up in the bowl.

  • (cs)
    aaawww:
    Could someone explain to me why a simple

    /[a-z._-]+@[a-z.-]+.[a-z]{2,3}/i

    does not suffice?

    [email protected]

    [email protected]

    fred&[email protected] (valid, and an autoresponder... go ahead, try it!)

  • zoips (unregistered) in reply to pjt33
    pjt33:
    They missed at least one bug in verifyEmail: if the string doesn't contain an @ then nIndex and nLastIndex will be the same but strTkn1 will have length one, so they'll try to access and out-of-bounds array index.

    Of course, since there is no such thing as an out of bounds array index in Javascript, well, I'm not sure...something something monkeys.

  • (cs) in reply to Anon
    Code Dependent:
    Reaver121:
    Without those I would happily chuck the thing into the toilet.
    Interestingly, that's exactly what I did with my previous phone. Not on purpose, mind you... hint: don't carry your cell phone in your shirt pocket when using the restroom.
    Even better hint: don't do handstands on the toilet.
  • Funny (unregistered) in reply to Inhibeo

    Yet another area where you are decades-late yet somehow think to be in advance or something. In the rest of the world, we use SIM-based GSM phones, get them free from the provider and get new ones free every two years too. Plus they roam across country borders and operators, so we have service everywhere, including in most parts of the US as our phones are multi-bands :-)

  • Jay (unregistered)

    I use Net10. It's a wonderful service, but their web site sucks big time.

    Wonderful part: They charge 10 cents per minute, and 5 cents per text message. You have to spend at least $15 per month to keep the service active, but if you don't use the time this month, you can roll it over indefinitely. I probably average $20 per month, which is less than half what I spent with my previous provider, not even counting what they charged if I went over my allotted time for the month. Someone who's on the phone a lot -- salesmen or really chatty people -- are probably better off with a plan that gives unlimited time for a fixed monthly fee, but for me who uses a phone rather infrequently, this is great. Even my teenage daughter rarely uses more than $15 per month, because she mostly text-messages, so $15 means 300 messages.

    The web site, though, is virtually useless. Theoretically you can add minutes to your phone through the web site. In practice, about three out of four times this fails with server errors of one sort or another and I end up calling customer service and talking to a person to buy minutes. I've sent them numerous emails complaining that adding minutes through the web site doesn't work. Their response is always, "We see you have now succeeded in purchasing additional minutes" -- which I did by calling customer service because the web site didn't work -- "so we assume the problem is solved." I've had this exchange several times. Once or twice I wrote back to explain that the problem was not solved but I just worked around it. I got no response.

    You can create an account on the web site, and then register all the cell phones your family owns under this account. Sounds handy. Except ... as far as a I can figure out, the only things this does for you are, (a) you can then go back to the web site and get the list of phones that you've registered, and (b) you can cancel the "add a certain number of minutes every month automatically and bill my credit card" feature. You can't add the automatic minutes per month through your account, you have to do that elsewhere. But you can cancel it. A naive person might suppose that once you have registered your phones under an account, that you could add minutes to a phone by, say, selecting that phone from a list, clicking an "add minutes" button, maybe doing something to confirm your credit card, and boom, you're done. Silly silly person. No, even assuming that adding minutes through the web site worked, to do this you must enter the serial number of your phone -- not the phone number, but the serial number -- separately. Even though you've already registered the phone under your account. You can't just select it from the list, you have to re-enter the serial number. And you have to re-enter your credit card information. This is exactly what you have to do if you don't have an account. So what do I gain by setting up an account? See (a) and (b) above. I suppose if I want to add minutes to my daughter's phone when she's not home so that I can't check her phone to get the serial number, I could go to my account, call up the list of phones, copy down her serial number onto a piece of paper, then go to the "add minutes" feature and type it back in. But I could do that by having the serial numbers in a text file on my hard drive. Real handy.

  • Jay (unregistered) in reply to pjt33
    pjt33:
    Code Dependent:
    Reaver121:
    Without those I would happily chuck the thing into the toilet.
    Interestingly, that's exactly what I did with my previous phone. Not on purpose, mind you... hint: don't carry your cell phone in your shirt pocket when using the restroom.
    Even better hint: don't do handstands on the toilet.

    DOn't try to flush the toilet either, as that might involve bending over near the toilet.

    Or don't you flush toilets where you live, Pjt33?

  • Anon (unregistered) in reply to Anon
    Anon:
    Code Dependent:
    Reaver121:
    Without those I would happily chuck the thing into the toilet.
    Interestingly, that's exactly what I did with my previous phone. Not on purpose, mind you... hint: don't carry your cell phone in your shirt pocket when using the restroom.

    I won't ask what you where doing in the restroom that caused a phone from your shirt pocket to end up in the bowl.

    I assume something like this: [image]

  • (cs) in reply to Anon
    Anon:
    Code Dependent:
    Reaver121:
    Without those I would happily chuck the thing into the toilet.
    Interestingly, that's exactly what I did with my previous phone. Not on purpose, mind you... hint: don't carry your cell phone in your shirt pocket when using the restroom.

    I won't ask what you where doing in the restroom that caused a phone from your shirt pocket to end up in the bowl.

    Leaning over to flush?

Leave a comment on “Plain Old Regexs”

Log In or post as a guest

Replying to comment #263155:

« Return to Article