Help with String Pattern

Hello,I need to make a pattern for a String. The field must accept numbers from 0 to 511 but musn't accept 1,2,3,9,12,13Can anyone help me?And it has to be controlled with a pattern...
[213 byte] By [Desireea] at [2007-10-3 6:41:24]
# 1
And it has to be controlled with a pattern...Why?~
yawmarka at 2007-7-15 1:30:28 > top of Java-index,Java Essentials,New To Java...
# 2
because I've been told to do it that way :)can anyone help me?any idea?
Desireea at 2007-7-15 1:30:28 > top of Java-index,Java Essentials,New To Java...
# 3
I've never heard the phrase "controlled with a pattern" relating to anything like that before. Who said it, and why? What did they say exactly?
paulcwa at 2007-7-15 1:30:28 > top of Java-index,Java Essentials,New To Java...
# 4
^(?!(?:1[23]?|[239])$)(?:5(?:0[0-9]|1[01])|[1-4]\d\d|[1-9]\d|\d)$
uncle_alicea at 2007-7-15 1:30:28 > top of Java-index,Java Essentials,New To Java...