Validate for street

Hallo all,

can someone tell me what can be the regulare expression for this:
“The Road”, “The Road 12”, “Road”, “On the Road 89”.

On Thu, Feb 19, 2009 at 4:05 PM, Hello G.
<[email protected]

wrote:

Hallo all,

can someone tell me what can be the regulare expression for this:
“The Road”, “The Road 12”, “Road”, “On the Road 89”.

Posted via http://www.ruby-forum.com/.

If you want to match all strings, /Road/ will work

Andrew T.
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

“I have never let my schooling interfere with my education” - Mark Twain

On Feb 19, 2009, at 9:05 AM, Hello G. wrote:

Hallo all,

can someone tell me what can be the regulare expression for this:
“The Road”, “The Road 12”, “Road”, “On the Road 89”.

Your question doesn’t make sense. Do you mean a regular expression
that will match ‘Road’ in each of those? If so, it’s easy /Road/, but
I suspect you’ll want to expand your question a bit.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

Rob B. wrote:

On Feb 19, 2009, at 9:05 AM, Hello G. wrote:

Hallo all,

can someone tell me what can be the regulare expression for this:
“The Road”, “The Road 12”, “Road”, “On the Road 89”.

Your question doesn’t make sense. Do you mean a regular expression
that will match ‘Road’ in each of those? If so, it’s easy /Road/, but
I suspect you’ll want to expand your question a bit.

-Rob

Rob B. http://agileconsultingllc.com
[email protected]

ok i ask so:
is this ok for like this “The Road”, “The Road 12”, “Road”, “On the
Road 89”:
/^[[:alpha:]]+(\s{1})([[:alpha:]])(\d)*$/

On 19 Feb 2009, at 15:34, Hello G. wrote:

ok i ask so:
is this ok for like this “The Road”, “The Road 12”, “Road”, “On the
Road 89”:
/^[[:alpha:]]+(\s{1})([[:alpha:]])(\d)*$/

Try it yourself in irb :slight_smile:

Fred

Phlip wrote:

Hello G. wrote:

/^[[:alpha:]]+(\s{1})([[:alpha:]])(\d)*$/

Uh, what does (\s{1})* do?

In general, you cannot validate at this level of detail, because
addresses like
“The Batman, c/o Gotham City PD” will always fail. With terrible
consequences…

hmm, what do you propose?

In general, you cannot validate at this level of detail, because
addresses like
“The Batman, c/o Gotham City PD” will always fail. With terrible
consequences…

hmm, what do you propose?

Reward your customer, such as with free software, for providing correct
info? (-:

Hello G. wrote:

/^[[:alpha:]]+(\s{1})([[:alpha:]])(\d)*$/

Uh, what does (\s{1})* do?

In general, you cannot validate at this level of detail, because
addresses like
“The Batman, c/o Gotham City PD” will always fail. With terrible
consequences…

Phlip wrote:

Hello G. wrote:

/^[[:alpha:]]+(\s{1})([[:alpha:]])(\d)*$/

Uh, what does (\s{1})* do?

In general, you cannot validate at this level of detail, because
addresses like
“The Batman, c/o Gotham City PD” will always fail. With terrible
consequences…

This is correct for streetnames in germany, these are for example:
“Road”, “This Road”, “My Road 8”

I have write 8 tests and their validates in model. It works great.
Then I write
def test_street_validate
assert_match(/^[[:alpha:]]+(\s{1})([[:alpha:]])(\d)*$/, “Deine
Strasse”)
end

but i didnt write this validation in model and i do the test: there are
no
failures or errors.
i thought their must be one failure because his validation isnt in
model?

then when i write the street validation in model and do the test now,
there are 3 failures in 3 different tests.

whats that?

please help