Hello D.J Bonlay D.J,
> Hi,
>
[quoted text clipped - 13 lines]
> such as Expresso etc etc.. but it fails in my code.. I do not
> understand since the Regex syntax is the same
This could be because in code it actually uses ECMAScript mode and Javascript
on the clientside. If you hadn't tested that setting and that engine the
results will always be unpredictable. That is the problem with the fact that
every programming environment has their own flavour of regex. They're all
almost equal, but all quite different.
> 1aaaaaaa passes fails in mycode
> a1aaaaaa passes fails in mycode
[quoted text clipped - 7 lines]
> aaaa1111 passes fails in my code
> Can anyone help me - thanks
instead of [\\w] try \w, I think that Javascript interprets that differently
than .NET.
And because you know that the first part will never be longer than 7+one
digit, you should rewrite that to:
^(?=.{0,7}\d)\w{8,8}$
For performance reasons.
This might also work:
^(?=.{8}$)\w{0,7}\d{1,8}\w{0,7}$
And finally you could also use 2 validators, one to validate the length and
a second to validate the pattern. That way you can just use these two patterns:
^.{8}$
^\w{0,7}\d{1,8}\w{0,7}$
--
Jesse Houwing
jesse.houwing at sogeti.nl