Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.help > #4131
| Newsgroups | comp.lang.java.help |
|---|---|
| Date | 2016-10-18 05:41 -0700 |
| References | (7 earlier) <nospam-76ABB7.09400428122008@feeder.motzarella.org> <ba2345eb-e7ab-471f-98fa-7da6f8b8ed51@x8g2000yqk.googlegroups.com> <nospam-6A8316.10293429122008@nntp.motzarella.org> <09420b4c-2d19-4f07-ba9f-5d5a7ce1e26d@i20g2000prf.googlegroups.com> <nospam-8639D0.12383029122008@nntp.motzarella.org> |
| Message-ID | <28bb0243-f59f-40bc-bffa-b3b9ed0d6bf4@googlegroups.com> (permalink) |
| Subject | Re: Parsing MT940 SWIFT Message using Java REGEX |
| From | smurugavelmsc@gmail.com |
On Monday, 29 December 2008 23:08:30 UTC+5:30, John B. Matthews wrote:
> In article
> <09420b4c-2d19-4f07-ba9f-5d5a7ce1e26d@i20g2000prf.googlegroups.com>,
> Arun <setsun@gmail.com> wrote:
>
> > On Dec 29, 8:29 pm, "John B. Matthews" <nos...@nospam.com> wrote:
> [...]
> > > <http://java.sun.com/docs/books/tutorial/essential/regex/>
>
> What syntax errors did this approach discover?
>
> [Please trim sigs.]
>
> > I think I did not explain my requirement.
> > I have 3 lines
> >
> > LINE 1 -> :61:0112201223CD110,92NDIVNONREF//08 IL053309
> > LINE 2 -> /GB/2542049/SHS/312,
> > LINE 3 -> :62F:C011021USD175879,84
> >
> > And I grab line 1 & 2 using pattern "(:61:.*?.[^:]+)" and copy it to
> > a StringBuffer. Now, with matcher.group(int arg) function, i need to
> > group the sequence so that i can get the 2nd line.
> >
> > matcher1.group(1) should return :61:0112201223CD110,92NDIVNONREF//08
> > IL053309 ( along with the \n ) and matcher1.group(2) should return /GB/
> > 2542049/SHS/312,
> [...]
>
> You could try matching the \n:
>
> Pattern p = Pattern.compile("(^.*\n)(.*\n)", Pattern.DOTALL);
> Matcher m = p.matcher(s);
> if (m.matches()) ...
>
> Again, an <http://sscce.org/> would make discussion easier.
>
> [Please trim sigs.]
>
> --
> John B. Matthews
> trashgod at gmail dot com
> http://home.roadrunner.com/~jbmatthews/
Hi John, i came across one of your post today regarding parsing MT940 file. I am working on a requirement were the file looks as below;
:61:161107D6243,23NXPC2000136822
:86:XPC?00ISSUANCE?20INV:5111107901 DTE:20161107 AMT:742.00?21INV
:5111107903 DTE:20161107 AMT:994.74?22INV:5111107869 DTE:201611
07 AMT:479.00?23INV:5111107872 DTE:20161107 AMT:850.00?24INV:511
1107873 DTE:20161107 AMT:500.44?25INV:5111107875 DTE:20161107 AMT
:634.30?26INV:5111107897 DTE:20161107 AMT:405.10?27INV:51111079
00 DTE:20161107 AMT:1020.25?27INV:5111107867 DTE:20161107 AMT:61
7.40?30CITISUPLFIN?31109087?32LOOS AND CO INC?3324356
I want only the keytags to start with a colon and not other lines. The expected output is i want them in a straight line instead of multiple lines. Please help me.
- Muru
Back to comp.lang.java.help | Previous | Next | Find similar
Re: Parsing MT940 SWIFT Message using Java REGEX smurugavelmsc@gmail.com - 2016-10-18 05:41 -0700
csiph-web