Questions tagged [parsing]

Parsing is the process of analysing a string of symbols, either in natural language or in computer languages, conforming to the rules of a formal grammar.

Filter by
Sorted by
Tagged with
9
votes
6answers
492 views

Parse a simple key=value config file in C

Write a program that should read a file formatted strictly like this below: $ cat sample bingo=2 bingo2=939 bingo3=text The left and right side of ...
2
votes
0answers
27 views

Command String Parser

I'm working on a library that, in essence, splits a string at whitespace, with extra rules: Consecutive whitespace is collapsed, and trimmed at the start and end. Whitespace wrapped in quotes is not ...
4
votes
1answer
79 views

Footwear scraper

I've done this parser to scrape all footwear data, but I don't know if it is good to use OOP in this case. Can you please check this out and give me the strongest feedback? I'm working on improving my ...
11
votes
3answers
2k views

Convert a string like 4h53m12s to a total number of seconds in JavaScript

At the moment I have this: ...
1
vote
0answers
28 views

git status parser using regular expressions in javascript

I'm looking for improvements of a code that filter the output of git status --ignored and git status --ignored -bs commands. I ...
4
votes
2answers
185 views

Parser for STL stereolithography data files [closed]

I'm parsing STL files to load the coordinates. My code is: ...
4
votes
1answer
51 views

Wavefront 3D Obj parser/viewer

For learning Rust I decided to make a 3D .obj viewer. I wrote a simplified OBJ parser without materials that only supports triangles. Considering I'm completely new to Rust and don't really know ...
6
votes
4answers
1k views

Parse source code of the RAPID robot-automation language

I am new to C, and I have very little formal education on programming (Although I am currently in college). I work as a Robot Automation technician, and me and my team are required to document a lot ...
2
votes
1answer
60 views

JSON Parser, pulls data from a JSON file for analysis

This is the first time I have programmed something that I will actually personally use, so I am happy about that. I tried to write good code whilst applying functional programming concepts. So no ...
17
votes
5answers
4k views

Speeding up thousands of string parses

I have a mapping application which takes string arguments in the form of string arrays. I parse these and then perform an action on the map. One of these is ...
4
votes
1answer
113 views

Email Generator

I've made a email generator, that uses a HTML template and replaces keywords in the template with information taken from a database. I'm looking to see if there is a way to improve the coding. ...
1
vote
2answers
52 views

Parse date format in Pandas using Python

I have a column in a Pandas Dataframe containing birth dates in object/string format: 0 16MAR39 1 21JAN56 2 18NOV51 3 05MAR64 4 05JUN48 I want to ...
3
votes
0answers
50 views

Reading and parsing binary file from CAEN Digitizer (written by WaveDump)

Preliminaries I have CAEN Digitizer N6720A and use WaveDump software for the data acquisition and recording. As a result of data recording this software produces a binary file in which the sequence ...
6
votes
2answers
114 views

Compact command line argument parser : Revisited

This question is a follow up to my previous one which can be found here. The user dfhwze suggested me to look into compiler construction and recommended me to write a lexer and a parser that would ...
-2
votes
1answer
86 views

Parse header information [closed]

Concrete Context: I parse the header information from curl execution/request and get the array named $headerARR. At this point it looks like the next example, but ...
2
votes
1answer
78 views

Compact command line argument parser

So, I decided to write my own little command line argument parser for various other projects I work on. I am aware that there are many good command line parser libraries, but I did wrote my own anyway ...
3
votes
1answer
140 views

A simple TCP command executer

In https://github.com/pc-magas/tcp_command as an attempt to learn C++ I made a simplistic TCP server in GNU/Linux that will receives simple "commands" in ASCII form. Each command ends with '\n' and a ...
3
votes
1answer
76 views

Parsing Game Entities

Could use some help with my presentation in Software Development. I'm presenting how I reworked a game's parser (SpaceTaxi). Basically we take in a .txt file with ASCII characters and convert them ...
10
votes
1answer
315 views

Credit card validation in C

I am relatively new to C programming and I am currently working through the CS50 EDX course. The problem I have solved below is for week 1 (credit). Any suggestions on how to improve this code to ...
5
votes
0answers
65 views

Parsing Long Excel Report Files for Predefined Results

I work as an IT intern in a multinational and I was given a tedious task of combing through a 2500+ long multi-column excel report file in search of inactive servers. Here's a sample row from that ...
5
votes
1answer
66 views

Try Parse Multiple Types

I am trying to write a method that takes in a String and returns an Object. The catch is I want to parse it to one of a few ...
3
votes
1answer
36 views

helper function to determine if html text is wrapped with a certain tag

I have this code that I've made to parse a string of HTML and tell me if it is all enclosed within a specified tag: ...
9
votes
2answers
121 views

Extract Information from Egyptian National ID

I did a script to extract information from the Egyptian national ID, e.g. national id is 14 digit ex(29501023201952). It could divide as described below: ...
1
vote
1answer
56 views

Getting the count of how many times a route has been hit

I have this log file (example below) and I'm trying to find the number of times a particular route is called. Example log file: ...
6
votes
3answers
250 views

Function to extract float from different price patterns

I've got a project where I get product data and need to get the prices which come in, in different formats. Some examples would be: US$17, USD17.00, 17,00€, 17€, GBP17, Only 17,-€, 17.000,00€, 17,000....
6
votes
1answer
85 views

Simple function to create Tokens from user input

I am new to programming in Rust and as an exercise I was making a simple Lottery checker program. It has a simple menu, the user enters a number for the corresponding option such as 'Add a line', '...
4
votes
2answers
78 views

Simple INI file parser in Haskell

I've written a rudimentary parser for INI files: ...
8
votes
1answer
146 views

Lazy, Functional Parser Combinators

Parser Combinators are the amazingly elegant way to write parsers that has evolved over on the functional programming side of the world, but have been less available or accessible for imperative ...
2
votes
1answer
64 views

Union based encoding of .csv file into a data table with different types [closed]

I am writing a program that has a row-based data table class. It also has an encoder class that is intended to take in some .csv data and convert it into a 2darray of encoded data of unknown type at ...
5
votes
1answer
37 views

Analyzing a web access log to obtaining totals for requests

This program takes the filename as the input and outputs to a file the number of requests that were more than 1000 bytes and the total bytes. Log file example: ...
2
votes
2answers
65 views

Split calculation string into parts

Our professor has given us the following task (its part of a bigger document full of tasks): Write a function in C that handles strings like "233+343" and parse them into the variables "iNum1", "cOp" ...
9
votes
2answers
527 views

Extracting the parent, leaf, and extension from a valid path

Powershell has the Split-Path cmdlet which allows you to extract the Parent and Leaf of a file. In PS version 6, you can extract the extension, with the ...
5
votes
2answers
101 views

Parsing parameters for a potential function

Background A forcefield is a collection of functions and parameters that is used to calculate the potential energy of a complex system. I have text files which contain data about the parameters for a ...
2
votes
1answer
38 views

Determine if a String can be parsed to LocalDateTime or Int

I have the following kotlin function that takes in a string "value", then attempts to parse "value" as both a LocalDateTime and an Int. It returns a Pair of the parsed value of "value" and an enum ...
3
votes
0answers
91 views

Extract the IP address from the output of ipconfig when connected to multiple wireless networks

I am trying to extract the ip address of my machine when connected to multiple wireless networks. The motivation here is then I can make a socket connection on that ip when I have two networks that ...
3
votes
1answer
72 views

Settings class implementation

I have a settings.txt file with the following format: ...
3
votes
0answers
53 views

Parsing version from Cargo.toml

I want to get version from Cargo.toml and use the value inside my app. Here is a function I wrote: ...
2
votes
1answer
71 views

.NET Custom hierarchical expression to treeview data structure

I'm not good at English. It's gonna be hard to read. I apologize in advance. I need expression parser for draw diagram(fault tree). In order to do that I have to create data structure from ...
11
votes
1answer
1k views

Factorio analysis: data munging

This project is... a little ridiculous. It's working, but it's a complete mess. Data about Factorio's game economy are pulled from the wiki via the MediaWiki API, scrubbed, preprocessed, and thrown ...
6
votes
2answers
103 views

C++ Saving And Loading Data For A Game To a Text File Using fstream

So i have written this code to save and load data for my C++ game to a file, this way I don't have to hard code every single room and item for the game. Essentially here's how the game works: So you ...
7
votes
1answer
227 views

Overloading istream>> to read comma-separated input

I have the following very simple class: ...
5
votes
2answers
95 views

Parsing pairs of a number or number range

I need to process an array of number pairs. Here are the constraints on the pairs: The second item may be missing, in this case 0 will be used as second item - - 38...
1
vote
0answers
45 views

AST Visitor Pattern in Java

I am trying to make a simple expression evaluator in Java using Jacc (a parser generator). I am done with the AST creation and now need to create an evaluator. For this I made a simple test to try to ...
6
votes
3answers
102 views

Method to remove comments from a string line

There is some language where the following are considered comments: [str] // comment [str] /* comment */ [str] ...
3
votes
2answers
34 views

Parse a date in various formats

I have a problem similar to the question, namely reading in text which describes a date - in various formats. I want to use the parseTimeM function from ...
1
vote
2answers
59 views

Substituting variable placeholders that may be intermixed with HTML tags

I needed to substitute variables of the syntax {FIRST_NAME} in a HTML template. The problem is that the template comes from a WYSIWYG system, and so the ...
6
votes
2answers
131 views

Parse dblp XML and output sums of publications grouped by year and type

The following Go program parses a gzipped XML file (available here) which contains bibliographic information on computer science publications and has the following indicative structure: ...
2
votes
1answer
89 views

(Codewars): Find the Unknown Digit

Kata: https://www.codewars.com/kata/find-the-unknown-digit/train/python To give credit where credit is due: This problem was taken from the ACMICPC-Northwest Regional Programming Contest. Thank ...
2
votes
1answer
48 views

segstr - Get delimiter-separated segments from a string in a non-destructive method

I wrote my first useful function in C which can be used in a different variety of situations as an alternative to common code logic. segstr (originally named ...
6
votes
4answers
1k views

Parsing a string of key-value pairs as a dictionary

I always use nested list and dictionary comprehension for unstructured data and this is a common way I use it. ...