String Example:
- AFN/FMHABX983,.XXXXXX,,155650/FPON43531W078351,0/FCOADS,01/FCOATC,017167^M
I need a regex that will find /FCOATC,01
/FCOATC, is a fixed match
The values after the comma can be: 01,02,03,1,2,3
7176 is a CRC value and can be any 4 Alpha Num Characters.
I originally started with this regex (\/)FCOATC,[^\/|^\n]* But then realized that I also don't want it to match on the 4 character CRC value. But I'm struggling because the values after the comma can be 1 or 2 characters.
Note: I have the ^/ included because this FCOATC section might be followed by another section that would start with a /. For example:
- AFN/FMHABX983,.XXXXXX,,155650/FPON43531W078351,0/FCOADS,01/FCOATC,01/FCOXYZ,17167^M
So I need it to take each instance into consideration.
Edited to add the following: To break out the /FMH portion I have a dilemma there as well. The breakout for that section is as follows:
Fixed Match /FMH
1-7 alpha numeric characters
Fixed Match ,
7 [.0-9A-Z-] characters
Optional Fixed Match ,
Optional 6 characters
Optional Fixed Match ,
Optional 6 digits
All of that could be followed by a / or a 4 character CRC code that would be followed by a carriage return line feed. I want to grab everything listed above, excluding the / or 4 character CRC that could follow.
Examples:
/FMHABX983,.XXXXXX,,155650/
/FMHABX983,.XXXXXX/
/FMHAMX022,.XXXXXX,A07176,003555/
/FMHAMX022,.XXXXXX,A071761234\r\n
/FMHABX983,.XXXXXX1234\r\n
/FMHABX983,.XXXXXX,,1556501234\r\n
/FMHABX983,.XXXXXX,,1234\r\n
/FMHABX983,.XXXXXX,1234\r\n
Thank you for your help!