regex - Regular expression to debatch MT940 message -


i got message below structure, message starts tag :20: , ends @ :86:. want write regular expression extract messages. write c# utility extract each message , put in arraylist.

:20:160212-2359 :21:600******444 :28c:00001/00001 . . . :86:daily settlement /entry-13 mar :62f:d160212gbp1229387,45 :64:d160212gbp1229387,45 :65:d120314gbp1229387,45 :65:d120315gbp1229387,45 :65:d120316gbp1229387,45 :65:d120317gbp1229387,45 :65:d120318gbp1229387,45 :86:forward available funds show items known not yet posted more comments in 86_2 segment  line2 :20:160212-2359 :21:b***22 :25:60*****88 . . . :86:/entry-13 mar trf/ref 6*******64 /ord/ line here  *********************** /bnf/ jo 88 :62f:c160212eur13868931,00 :64:c160212eur13868931,00 :65:c120314eur13868931,00 :65:c120315eur13791849,00 :65:c120316eur13791849,00 :65:c120317eur13791849,00 :65:c120318eur13791849,00 :86:forward available funds show items known not yet posted more comments in 86_2 segment. :20:160212-2359 :21:b****x :25:6*************1 :28c:00001/00001 :86:store1 europe b.v. /entry-15 mar rts/ref 6*****6 rts  swept 9999 1**** xx***********billing charges -  28feb12 trf/ref 6641xxx43799053 /itemcnt/004 /bnf/ /itemcnt/004  billing charges :61:1203130313dr10000000,00****288//6*****6 :86:store1 cnrty srl /entry-13 mar clg/ref 66**********6 :61:1*****000,00nt*****9846//6******74 :86:name /entry-13 mar clg/ref 6******4 la c****r  **** cash deposit store1 :61:1203150315dr48531,00nchgbilling charges//6641xxx43799053 :86:billing charges - 28feb12 /entry-15 mar trf/ref  66******53 /itemcnt/004 :62f:c160212eur0,00 :64:c160212eur0,00 :65:c120314eur0,00 :65:c120315eur0,00 :65:c120316eur0,00 :65:c120317eur0,00 :65:c120318eur0,00 :86:forward available funds show items known not yet posted {newline} 

actual values replaced '*' character.

thanks dhiraj bhavsar

try this

:20:(.*?):86: 

in code

/:20:(.*?):86:/gs 

https://regex101.com/r/dw4zs3/1

.*? matches character between 0 , unlimited times, few times possible, expanding needed


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -