Regular Expression Traps Examples
I am long time Monarch user, but never used Regular Expression Traps (RegEx). Is there any Altair Monarch videos tutorials on how to use RegEx Traps? I am trying to read EDI XML files and there are multiple "Address" sections where I need to pull out the AddressName (vendor name) which in not always on the same line following the "VN" section of the file. I tried using the Start/End region but that wont work because I have Detail and Append and Footer traps outside the Start/End region.
I found a work around by using a multi-line trap and then using a calculated field which uses Instr functions to find the ling containing "AddressName. This works, but I thought I could use RegEx Trap as a more reliable Trapping function.
Thanks in advance for any help
Thanks
Al
Answers
-
I did not see any videos during a quick search of our library (old and newer versions). The biggest hurdle trying to teach regular expression traps is the end user has to already understand what regular expressions are and how they work. We do provide some helpful links in the help file
https://docs.datawatch.com/monarch/desktop/Creating_a_Regex_Trap.htm
https://msdn.microsoft.com/en-us/library/hs600312(v=vs.110).aspx
http://www.regular-expressions.info/ (My favorite)
Keep in mind there are many flavors/varieties of the regular expression implementation and Monarch is based of the .Net version.
Also be aware that when data is brought into report design (classic or DPS), tabs are converted to spaces so you cannot use the \t character escape to match a tab.
You mentioned that this was an XML file. I wasn't sure if you tried using Data Prep Studio to bring in the XML and if that was helpful at all. Is it possible to share a sanitized example of the data you are using?
0 -
Thanks... I will brush up on my .net knowledge.
Al
0