tags:

views:

43

answers:

2

Hi all,

i have simple regular expression:

^123$

Matches are for example

123
1234

etc.

How can i exactly 123 as result without the 1234 (i'm not sure, if it's possible)?

+2  A: 

^123$ doesn't match 1234 - exactly what you want. So what's the problem?

^ means start of string to be matched

$ means end of that string

Artem Russakovskii
i know., but i get more than one result for this.....it seems, that i have a bug :(
cupakob
+2  A: 

The regex you gave should match only the string "123" and should not match "1234". I don't know what you're doing wrong to get it to match "1234", but it's not the regex.

Chris Lutz
it seems, that i get both 123 and 1234 as results....so the problem is not in the regex. I must debug now. thanks a lot.
cupakob
You could clarify a little - more about what language you're using and what your current code looks like could help us figure out what the problem really is.
Chris Lutz
i know, where ist the problem - i have some wrong DB entries.
cupakob