jeudi 26 mars 2015

Java regex for # delimited record

I have text rows of following format. It is a record of fixed segments of upto 6 columns delimited by comma and which can repeat one or more times. The segment separation is delimited by #


Example:

single record in row:



AA,123,SRC,DES,X,ABCD123


two records in row:



AA,123,SRC,DES,X,ABCD123#AB,234,SRC,DES,X,ABCD234


I'm looking for build reg-ex for this structure pattern. So far I've build partial reg-ex based on my requirements (which will be case-insensitive).



regexp ="^([a-z]{2},[a-z0-9]{1,5},[a-z]{3},[a-z]{3},[a-z]{1}(,[a-z0-9]{1,25})?)+$"


What I'm struggling with is finding the repeated segments. Here is a link that has some delimiter expression information but I'm unable to incorporate it. Can someone help me understand?


JAVA RegEx on _ delimited string


Aucun commentaire:

Enregistrer un commentaire