I'm trying to create an xsd dictionary for some data migrations, I don't fully understand how to format xsd:pattern values correctly, I was wondering if anyone had any ideas. I have some values that were done already:

        <xsd:pattern value="[a-zA-Z]{1}([#-. a-zA-Z0-9]*)"/>
        <xsd:pattern value="([ a-zA-Z0-9]*)"/>

But I don't know how to manipulate them to satisfy my current needs.

I have 4 different separate patterns I need to allow:

{ -7615.73809296812, 1741.59586829216, -4356.85343074448 }

142.891 and -100.78

"2721984247"

and

single letters (specifically the letter N and Y)

Thanks for any help :)
- Shannon

For your first pattern, you would require something like: \{(\-?[0-9]+\.[0-9]+,)*(\-?[0-9]+\.[0-9]+)\} Note that I made quite a few big assumptions for this:
- Cannot be empty ("{}")
- Cannot exclude the decimal or numbers before/after (".9", "9." or "9" would be invalid").
- Cannot start with a + sign.
Take a look at http://msdn.microsoft.com/en-us/library/ms256481.aspx for more information on Regular Expressions.

Your second and third patterns could simply use the decimal and integer types respectively, for example:

<xs:element name="price" type="xs:decimal"/>

Your fourth one could use the pattern: [NY] Or you could use <xs:enumeration value="N"/>... instead.

You should also check out W3 Schools as well. They usually have some good examples/tutorials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.