I cannot go into much of my project for a number of constraining reasons.
Essentially, I'm trying to pre-test an object before serializing it, and then check it for a schema. The schema has confirmation for the name, which I know is not ideal, and you better not check the name, but I cannot reproduce a valid regular expression for what the schema is trying to do.
<xsd:simpleType name="CharsetD"> <xsd:restriction base="xsd:string"> <xsd:pattern value="[A-Za-z \-']*"/> </xsd:restriction> </xsd:simpleType> <xsd:element minOccurs="0" maxOccurs="2" name="Fore"> <xsd:simpleType> <xsd:restriction base="CharsetD"> <xsd:minLength value="1"/> <xsd:maxLength value="35"/> <xsd:pattern value="[A-Za-z].*"/> </xsd:restriction> <xsd:simpleType> </xsd:element>
In this case, I just thought I could try and just use xsd:pattern for charset .
I tried to use the [A-Za-z \-']* , which returned the name, such as Luke2 , as valid, but the check scheme said that it is not because it contains a number.
My question is, how can I repeat the above in one c# regex? Also, are there any differences between the way the schema template works than if I used it in .NET , what can I note in the future?
source share