0

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.

Gilles Quénot
  • 173,512
  • 41
  • 224
  • 223
Sagarika
  • 41
  • 6
  • You'll want to anchor your regex at the start of input: `^.{54}00`. I've had some strange behaviour in some languages when specifying an exact number of characters rather than a range, not sure whether bean-io has the same troubles. If it's multiline, you'll want to use `[\s\S]` instead of `.` to make sure you include newlines. – adamdc78 Nov 18 '14 at 20:02

0 Answers0