Looking into a SWIFT message using RegEx, here is an excerpt:
:16R:FIN
:35B:ISIN CH0117044708
ANTEILE -DT USD- SWISSCANTO (CH)
INDEX EQUITY FUND USA
:16R:FIA
The goal is to extract information in group 3:
ISIN CH0117044708
ANTEILE -DT USD- SWISSCANTO (CH)
INDEX FUND V - SWISSCANTO (CH)
INDEX EQUITY FUND USA
However, only ISIN CH0117044708
is being captured.
Currently troubleshooting the RegEx issue with this expression:
/:([0-9]{2}[A-Z]){1}(::|:)((.*\r\n){1,4}|.*)/gm
To experiment further, check out this link: https://regex101.com/r/qX9cET/2
Edit: Exploring how to match this optional pattern:
([A-Z]*)(?:\/\/)?(.*(?:\/)?){0,2}
- No // and / in line
- // and a single /
- // and two /
Incorporated in the previous example (https://regex101.com/r/Ubci69/5):
:16R:FIN
:97A::SAFE//0123-456789-11-020
:35B:ISIN CH0117044708
ANTEILE -DT USD- SWISSCANTO (CH)
INDEX FUND V - SWISSCANTO (CH)
INDEX EQUITY FUND USA
:16R:FIA
:93B::AGGR//UNIT/0,117
:19A::HOLD//CHF237,15
:92B::EXCH//JPY/CHF/0,0087535442107