Regular expression in XML to match a substring at a particular position

926 views Asked by At

I am using an XML to validate a fixed length file.

<record name="claim" minOccurs="0" maxOccurs="unbounded" class="example.Example" >
        <field name = "claimId"  position="0" length="66" rid = "true" regex=".{54}00"/> 
        <field name = "remainder"   position="66" length = "109"  />
</record>

I am trying to use a regular expression to match a substring at the 54th position. I am trying to check if the 54th and 55th positions of the string contains the value "00". Please check my regular expression usage above and suggest. Thanks in advance.

0

There are 0 answers