drewnoakes / fix-decoder

Unravels FIX messages into human readable tables
https://drewnoakes.com/fix-decoder/
80 stars 34 forks source link

Allow ^A and tab separators in the parser #10

Closed whatthefrog closed 9 years ago

whatthefrog commented 11 years ago

Hi,

This is a nice tool, we modified the regexpr to allow ^A and tabular separators

I know it only breaks on ^, it works, so I guess you only keep digits for the fixtags part later on in the code

Tabs are little bit pointless as putty gives away spaces when copy pasting from it, but I guess some people use them for readability as we do, but I am not 100% sure they won't be used in the fix values

see diff below

svn diff
Index: scripts/app/FixParser.js
===================================================================
--- scripts/app/FixParser.js    (revision 23)
+++ scripts/app/FixParser.js    (working copy)
@@ -18,7 +18,8 @@
         FixParser.prototype.parse = function(str)
         {
             // Create a sequence of fields
-            var regex = /([0-9]+)=([^|\001]*)/g,
+            var regex = /([0-9]+)=([^|\001^\t]*)/g,
                 fields = [], result;

             var fixVersion = 'unknown';
@@ -113,4 +114,4 @@

         return FixParser;
     }
-);
\ No newline at end of file
+);
drewnoakes commented 11 years ago

@whatthefrog could you provide an example message that has this formatting? I'd like to understand this issue better.

whatthefrog commented 11 years ago

Thanks for your reply, this is not really an issue as such, just the \01 fix delimiter char shows as ^A when we less our logs

we also tend to replace them with tab, e.g

cat fix.log | tr '\01' 't' | less

but tabs are not copy pasted by putty, so we may just use | from now on to use your tool

whatthefrog commented 9 years ago

Closing this, we use pipes now, works fine