Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Re: Help for XML pattern

Reply
Thread Tools

Re: Help for XML pattern

 
 
Martin Honnen
Guest
Posts: n/a
 
      03-25-2010
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/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
C++ and design Pattern (Composite design Pattern ) Pallav singh C++ 0 01-22-2012 10:26 PM
C++ and design Pattern (Composite design Pattern ) Pallav singh C++ 0 01-22-2012 10:25 PM
May I have a example of design pattern of "composite", I still feel fuzzy after reading book of Addison-Wesley's"design pattern " jones9413@yahoo.com C++ 1 08-31-2007 04:09 AM
documents related to factory design pattern and Abstract foctory pattern. sunny C++ 1 12-07-2006 04:26 AM
boolean endsWith(String s, Pattern pattern) lepikhin@gmail.com Java 17 11-16-2005 10:31 AM



Advertisments