XML : File Name Format Match (PHP)

I am working on xml feeds and I have few xml files of two formats which are very similar:

XML 1 format

  c<date><id><time>.xml    

XML 2 format

  c<date><id><time><revision>.xml    

where:

  • C is always 1 char
  • DATE is always char format
  • ID is at least 5 char but could increase time to time.
  • TIME s always 4 char format
  • REVISION is always 4 letter format

now you can understand the issue is to separate the first format from the second format when the ID changes dynamically.

I am using preg_match alongside regex to match the whole format but my real question is there any way of actually matching the formats even if the id changes dynamically into 7-8-9 chars?

I am not sure if I was clear, please advice in case not.

Can anyone help or suggest?

Thanks in advance

No comments:

Post a Comment