1

How would I find address records the do not contain a digit followed by a space? (eg., 15SMith St. as opposed to 15 Smith St)

WHERE a.address not like '.[0-9] .'

is clearly not working for me.

2
  • 1
    What about WHERE a.address NOT SIMILAR TO '%[0-9] %'? Commented Feb 8, 2017 at 20:44
  • Perfect! Thank You! Commented Feb 8, 2017 at 20:56

1 Answer 1

2

You may use SIMILAR TO with NOT and a pattern that is a "a curious cross between LIKE notation and common regular expression notation". It supports [0-9]:

A bracket expression [...] specifies a character class, just as in POSIX regular expressions.

So, you may use

WHERE a.address NOT SIMILAR TO '%[0-9] %'

Here, % matches any number of any chars, [0-9] matches any digits, a space matches a space and then % again matches any number of any chars. These % are necessary because SIMILAR TO requires a full string match, same as LIKE.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.