Pizza67 wrote:
> Hi all,
>
> I need to define a new string-based simple type that allows the following
> patterns:
>
> String1 (that can be composed by any combination of [0-9], [A-Z] or [a-z] )
>
> or
>
> String1.String2 (where String1 and String2 are separated by a period (.) and
> can be both composed by any combination of [0-9], [A-Z] or [a-z] ).
>
> So possible allowed values can be:
>
> 123456
> qwerty
> M000123
> XXy123aah8829HJ00289jkjksls
>
> or
>
> abcdef.7890bH0
> zeZ001.123F55
>
> Can someone please suggest what pattern should I use to enable such
> restriction?
[a-zA-Z0-9]*(\.[a-zA-Z0-9]+)?
That would allow the empty string too but you can of course change it to
[a-zA-Z0-9]+(\.[a-zA-Z0-9]+)?
to require at least one character.
--
Martin Honnen
http://msmvps.com/blogs/martin_honnen/