views:

49

answers:

2

I am trying to get a regular expression for text, decimals and decimal numbers. The expression must match all at once.

The main problem is that I had to write an Analyzer for Zend_Search_Lucene in order to be able to search for decimal digits. Right now I can only search for texts and numbers. So I guess it to match decimal numbers to make them tokens and thus the regular expression in question.

A: 

modify this

^((\d{5}-\d{4})|(\d{5})|([A-Z]\d[A-Z]\s\d[A-Z]\d))$

http://regexlib.com/DisplayPatterns.aspx?categoryId=7&cattabindex=6

http://www.regular-expressions.info/examples.html

zod
okay thanks a bunch
burntblark
if you find it as your answer you can chek it as answered :)
zod
that's a lazy answer zod... do you even know what that expression does yourself? 5 numbers followed by a dash followed by 4 numbers..... where do you see that as a requirement in his question? actually, its an zip code or postal code that it's matching.
Mark
did you see in the begining i tell him to modify that. I just give a hint to how to write a regular expression . And those links are more than enough to meet his requirements. number and alphabet checking is there anyway , he just have to modify. You can be smart by giving better answers not by making fun of other.Try. Try..
zod
@zod: "modify that"? as in, completely rewrite it? no bit of that regular expression is salvageable, so it's completely useless. linking him to regexlib.com is slightly better, but still, most of those are garbage. i didn't submit an answer because (a) he already solved it, and (b) it wasn't clear what he actually wants to do
Mark
+2  A: 

Okay now i feel stupid but anyways. I finally got what I wanted. This, [a-zA-Z0-9.]+ did the trick. imagine how short that was.

burntblark