Regex flat data file to xml

18 views
Skip to first unread message

Stanny

unread,
Jan 31, 2013, 7:29:56 AM1/31/13
to re...@googlegroups.com
Hi all,

I almost finished this regex but I can't seem to finish it... =(


















































Obviously I need the values between the tags, lol

I use this website http://gskinner.com/RegExr/ (dotall & multiline checked)

This is sample data:

GLOBAL PAGELBL
Pag.
GLOBAL CMPADDR
SOMECOMPANY
Somewhere 15
Someplace
GLOBAL TELEPHONELBL
Telefoon
GLOBAL TELEPHONE
0000 0/00.000.000
GLOBAL TELEFAXLBL
Fax
GLOBAL TELEFAX
0000 0/00.000.000
GLOBAL ORGNOLBL
Orig.nr.
GLOBAL ORGNO
GLOBAL WEBSITE
GLOBAL EMAIL
GLOBAL SEAT1LBL
Maatschappelijke zetel
GLOBAL SEAT2LBL
Someplace
GLOBAL HANDREG
RPR
GLOBAL HANDREGNR
Someplace Else
GLOBAL TITLE
GLOBAL TITLE1
CREDITNOTA
GLOBAL INVNOLBL
Factuur
GLOBAL DOTY
DMC

Any help would be very appreciated!!

Kind greetings,

Stanny

Prashant Patole

unread,
Feb 11, 2013, 12:52:38 AM2/11/13
to re...@googlegroups.com
i have done such requirements many times and from many years

solution is,
you have to apply multiple expressions to handle special cases 
along with one or two major expressions to do all general cases.
and then apply them in recursion.


like this if you have got 6 regular expressions then write some code like this.

loop this six times
{
        out_string = apply_regex(in_string, regex pattern[loop count]);
        in_string = out_string;
}

this will considerably reduce the complexity and give a very simple solution to maintain. 

in addition write some code to test such, sequential expressions. this makes like further easy. 




--
--
Sub, Unsub, Read-on-the-web, tune your personal settings for this Regex forum:
http://groups.google.com/group/regex?hl=en
 
---
You received this message because you are subscribed to the Google Groups "Regex" group.
To unsubscribe from this group and stop receiving emails from it, send an email to regex+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages