#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Posts
    27
    Rep Power
    0

    Regex problems with America OnLine


    I have an online registration with the typical information such as name address, etc. This information is entered into a SQL server. It works fine for everyone except those with America On Line. They get the error message for the regular expression validator’s which pertains to the address and a text box. As anyone had this problem? Is there anything I can do so it is AOL friendly? If the problem is with the address validator (which is modified from one I found on the net), here it is:
    ^(?n?<address1>(\d{1,5}(\ 1\/[234])?(\x20[A-Z]([a-z])+)+ )|(P\.O\.\ Box\ \d{1,5}))\s{1,2}(?i?<address2>(((APT|BLDG|DEPT|FL|HNGR|LOT|PIER|RM|S(LIP|PC|T(E|OP))|TRLR|UNIT)\x20\w{1,5})|(BSMT|FRNT| LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR)\.?)\s{1,2})?)\, \x20)$
    And the (comment) text box is:
    ^\s*(\w\s*){1,150}\S*\s*$

    Thanks in advance.
  2. #2
  3. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,749
    Rep Power
    9397
    Kind of a shot-in-the-dark here, you haven't given us everything necessary. Like what address or comment failed the validation.

    I can't even get your expression to work. What are you using? Perl? PHP? Something else?
  4. #3
  5. garish grotesque gargoyle
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2006
    Location
    gracing gargantuan gothic gateways
    Posts
    1,337
    Rep Power
    1037
    why would a street address validator fail for all AOL users? the only commonality those users would have is their internet connection and (in many cases) their email addresses. are you sure your email validator isn't looking for more than 3 characters in the domain? joe@aol.com is a pretty short email address and might fail some strict checks. BTW - what kind of data are you going through? making so many assumptions about abbreviations used in addresses seems like it would automatically fail a whole lot of addresses... like requinix said, can we have some context to work with?

    "Human history becomes more and more a race between education and catastrophe." (H.G. Wells)
    "Giving me a new idea is like handing a cretin a loaded gun, but I do thank you anyhow, bang, bang." (Philip K. D!ck)
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Posts
    27
    Rep Power
    0
    Thanks for the reply's. First off, The registration page was working fine but for a handful of people. It was throwing errors on the street address and comment textbox. I tried to duplicate the errors on different browsers, isp's and even tried dial up, etc. All succeeded. Then I looked at their email addresses and they were all aol. Investigation confirmed that they did in fact use AOL as their ISP. All I know is; that is their common factor. It sounds wacky but true.
    All addresses they tried threw the error. These are rural people so they could try a regular street address as well as say U.S.1 or US 1. All failed I don't know where the smiley faces came from so I will try again. The address validator:
    ^(?n?<address1>(\d{1,5}(\ 1\/[234])?(\x20[A-Z]([a-z])+)+ )|(P\.O\.\ Box\ \d{1,5}))\s{1,2}(?i?<address2>(((APT|BLDG|DEPT|FL|HNGR|LOT|PIER|RM|S(LIP|PC|T(E|OP))|TRLR|UNIT)\x20\w{1,5})|(BSMT|FRNT| LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR)\.?)\s{1,2})?)\, \x20)$
    and the comment validator:
    ^\s*(\w\s*){1,150}\S*\s*$
    The expressions is used in an ASP.NET page. Thanks.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Posts
    27
    Rep Power
    0
    BLAST!! The frowning face is a colon .
  10. #6
  11. Come play with me!
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    13,749
    Rep Power
    9397
    Below the box for typing a post there's an "Additional Options" box. Arrow to the far right if it's collapsed down. In there is a "disable smilies in text" checkbox.

    I can see no reason why ISP would matter unless your code does something odd.

    What is an example address and comment that didn't work? (You can change street numbers or whatever, just keep the same number of digits.)
  12. #7
  13. garish grotesque gargoyle
    Devshed Beginner (1000 - 1499 posts)

    Join Date
    Mar 2006
    Location
    gracing gargantuan gothic gateways
    Posts
    1,337
    Rep Power
    1037
    I think your error is misreporting. if you can test it yourself with a normal street address and an email address @aol.com then maybe you can reproduce the error -- if you can't reproduce the error, then it must be some kind of communications issue.

    that regex is psychotic. in my opinion, if you need a 252-character regex that is that complicated, then you're doing something wrong. is there a reason you need to verify that PO boxes are entered with periods and/or that addresses have the appropriate abbreviations for locations? why the extra-complicated regex for address?

    can you make a test page that does not validate address at all and then run some test aol signups through it to see if you can get a different error message or remove the error altogether? Seems like something has to be triggering this that is not the address itself. If it is the address, I recommend simplifying the regex so that it validates the bare minimum address requirements your application needs.

    can you run through the code process that generates the error? e.g. does it have to pass other tests to get to that test, is that test conditional upon other requirements, etc etc. Sounds like other addresses pass the test just fine... seems like this regex can't be the issue directly. maybe someone can give a real analysis of this address regex -- I'm a bit stumped with the <address1> and <address2> entries and lookahead qualifiers. Perhaps this would be a clue as well.

    what is the data source? looks like your regexes are looking for very specific conditions (addresses may have no more than 5 digits, street name must be capitalized, comments cannot be longer than 150 characters, etc...) so unless your data source is already expected to meet these conditions it seems your regex could be kicking out totally acceptable addresses.

    I think I'm missing something major here. what ratio of addresses are kicked out compared to those accepted? is it ALL aol addresses or just mostly? do ANY aol addresses get accepted?

    let me know if you can provide any more info (if you post the regex again, use the highlighter tool or the number sign CODE tag to kill any smileys), and any results of any testing you've performed. in the meantime maybe someone can take a crack at fully explaining that address regex.

    good luck!

    "Human history becomes more and more a race between education and catastrophe." (H.G. Wells)
    "Giving me a new idea is like handing a cretin a loaded gun, but I do thank you anyhow, bang, bang." (Philip K. D!ck)
  14. #8
  15. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2005
    Posts
    27
    Rep Power
    0
    Hi, thank you for the response, sorry about the delay getting back to you. A little thing called a 3 day weekend got in the way. I will attempt to address your questions. I am a newbie who has lucked out getting things to work so it is highly believable that the “regex is psychotic”. I found one on the net and pared the city and state out to just use the street address, then it was found PO box couldn’t be entered so I stuck that in.

    Perhaps I can try to make the whole story clearer. I wrote the registration form and it worked on several computers. I put it on the website. Nobody had problems until someone tried to sign up some rural families on their (the families) respective computers. They kept getting errors for the fore mentioned textboxes. They brought the info back to the office and their addresses could be entered – no problem. I even had the person that was in the field helping the people do this (at the office) so I knew he was doing it correctly. I had no problem entering in the addresses with different browsers, isp’s, computers, etc. as was detailed previously. It was upon studying the email addy’s of the people that I noticed they had AOL accounts. Upon further investigation it was determined that they used AOL as their ISP. That is the only common denominator.

    These (altered) addresses were among those rejected:
    PO Box 457, They even tried P.O.; and 1380 S US Highway 1, over the phone I suggested for them to try Hwy, and leave off the S. Still wouldn't work. However, these worked when entered here at the office.

    One more try with the validator:
    Code:
    ^(?n:(?<address1>(\d{1,5}(\ 1\/[234])?(\x20[A-Z]([a-z])+)+ )|(P\.O\.\ Box\ \d{1,5}))\s{1,2}(?i:(?<address2>(((APT|BLDG|DEPT|FL|HNGR|LOT|PIER|RM|S(LIP|PC|T(E|OP))|TRLR|UNIT)\x20\w{1,5})|(BSMT|FRNT|LBBY|LOWR|OFC|PH|REAR|SIDE|UPPR)\.?)\s{1,2})?)\, \x20)$
    I guess I have to turn my efforts on learning this regex stuff so I can write a better validator. Thanks for all the help.

IMN logo majestic logo threadwatch logo seochat tools logo