By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,515 Members | 1,110 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,515 IT Pros & Developers. It's quick & easy.

Regular expression help...

P: n/a
Hi,

Hope that you can help me here. What the regualr expression for:

any amount of non-digit characters follwed by some digits (and perhaps
a letter or 2 after this) - that is strings found in address numbers
especially in apartment numbers

like, for example:

#23
apt. 34
No.21A
Any help on this much appreciated.

Thank you,
Al.

Apr 5 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
"al*****@altavista.com" <al*****@altavista.com> wrote in
news:11*********************@i39g2000cwa.googlegro ups.com:
any amount of non-digit characters follwed by some digits (and perhaps
a letter or 2 after this) - that is strings found in address numbers
especially in apartment numbers


[^0-9]*[0-9]*[A-Za-z]{,2}
Tim F

Apr 5 '06 #2

P: n/a
I tried my hand at this and here is what I came up with:

^\D+\d+[A-Za-z]?
If only I could test these...

Apr 5 '06 #3

P: n/a
Hi,
If only I could test these


<http://regexlib.com/RETester.aspx>

In my opinion, Regexes are only useful if you can very definitely
constrain the sample strings you might receive. Although the suggested
regexes might work (didn't test them), I would advise you to spare the
some thought to what anomalous address formats you might receive.

If the 3 examples you gave are the only possibilites, it would be good.
But as I read in good book sometime back : "All input is Evil !". In
other words, your users might enter text that you couldn't have
imagined in your wildest dreams. ;-)

Just my thoughts,

Regards,

Cerebrus.

Apr 6 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.