skip to Main Content

NEED INSIGHT: Using python I am using a regular expression to capture sample restaurant sales data to categorize and convert it to JSON from a .pdf

The regular expression I am using is ^s*(d+)s*(([A-Za-z]+s*)+)?(d+)s+(.+?)s+(d+.d+)s+(d+.d+)s+(d+.d+)s+(d+.d+)s+(d+.d+)s+(d+.d+)s+(d+.d+)s+(d+.d+)s+(d+.d+)$ When the following sample data string is parsed and categorized " 1 NA BEVERAGE 1100 ICED TEA 14.00 3.00 42.00 3.50 0.00 42.00 0.00 0.52 47.09" Output is incorrect: when you look…

VIEW QUESTION

Json – Object to array bug

So I wrote this function to convert an object to an array. Function: function objectToArray(obj) { const result = []; for (const [key, value] of Object.entries(obj)) { if (typeof value === 'object' && value !== null) { result[key] = objectToArray(value);…

VIEW QUESTION
Back To Top
Search