Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Regular Expression to restrict a field in schema - Pls advise

905784Apr 12 2012 — edited Apr 17 2012
Hello All,

I am trying to restrict a field in the schema which must follow below conditions:

1. field must start with alphanumeric characters but not with spaces(*<element>abcde</element>* is allowed but *<element></element>* or *<element> </element>* is not allowed)
2. field can have spaces in between or at the end of the field(*<element>abcde </element>*)

I tried using this but it is allowing the field if it is having more than 1 spaces i.e(<element> </element>):

<xsd:simpleType name="myElement">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
</xsd:restriction>
</xsd:simpleType>


also I tried using this but it is not allowing any spaces:

<xsd:simpleType name="myElement">
<xsd:restriction base="xsd:string">
<xsd:minLength value="1"/>
<xsd :pattern value="[^\r\n\t ]*"/>
</xsd:restriction>
</xsd:simpleType>

Please share your thoughts if we can create one.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 15 2012
Added on Apr 12 2012
10 comments
1,259 views