All Questions
75 questions
0
votes
1
answer
79
views
Parsing shortcodes out of a string
I wrote this shortcode parsing and it runs in \$O(N^2)\$. Is there a way to better optimize this?
...
1
vote
2
answers
175
views
Parse list of UserPrincipal objects into custom class
I'm wondering how I could optimize this method that takes in a list of UserPrincipal objects, filters them by Regex and inserts the new class instance into a list. It takes 4 to 5 seconds for an input ...
2
votes
1
answer
323
views
Text splitter using Regular Expressions in Python
I have been provided a text splitter class that will take a text input and use re.sub to make replacements when matches are found and also splits sentences up and stores them in a list.
I had an idea ...
2
votes
2
answers
116
views
Regex and pandas to read forecast sky condition string
DataFrame methods to parse the sky condition from a terminal aerodrome forecast.
A line in a taf can report zero-eight cloud layers. Cloud layers are required in predominate lines, and optional in ...
1
vote
1
answer
128
views
using pandas and numpy to parse dirty .csv
I'm relatively new to Python have been writing for a few months now. I've started a Pandas Numpy project that starts with parsing large and somewhat sloppy formatted textfile, its not exactly csv but ...
0
votes
2
answers
130
views
Parse file and make output in custom List [closed]
I have a file output like this and want to do parsing and put the output into a List. The biggest problem here is the name of a wake-lock which appears after ID and runtime, in some cases, it contains ...
3
votes
1
answer
264
views
Parsing values from string into struct using match in Julia
My goal
I am parsing from a string which contains token:value pairs into a type.
Example:
...
5
votes
2
answers
168
views
Separating data from string representation of objects, with added extras
Given a string representation of data, I want to extract the information into its corresponding object.
However,
If the string has "|" separators then these should be considered options and ...
7
votes
3
answers
253
views
parse date and number from API results
I'm slurping up fields from an API that returns an array of fields. Each field in the array is a String that actually contains two separate fields (a number and a date). The number is enclosed in ...
8
votes
1
answer
353
views
Parse data from Input file and print results
I have written a script which does parsing to the input file and take out some values from them with respect to the node and print the data accordingly.
Below is my script, and it works as expected:
<...
11
votes
3
answers
4k
views
Convert a string like 4h53m12s to a total number of seconds in JavaScript
At the moment I have this:
...
18
votes
5
answers
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 ...
5
votes
1
answer
68
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:
...
5
votes
2
answers
196
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...
5
votes
1
answer
239
views
Replacing Uri with a more convenient class
I needed some data structure for holding Uris so I thought I try the Uri class. It quickly turned out that it's very impractical because:
it's missing an implicit ...
9
votes
1
answer
134
views
Minimal regex engine
A few months back, I posted a state machine for review. Thanks to the feedback, I was able to greatly simplify the implementation. I am posting the revised version, together with the Regex class which ...
5
votes
2
answers
2k
views
Simple parser with regular expression
If I draw something in Illustrator and extract it with AI2Canvas I want it to be customizable so I wrote this simple program. It adds two variables: one to resize and one to shift the path coordinate.
...
12
votes
3
answers
8k
views
Parsing an email string
My program needs to parse an e-mail string. There are two possibilities to enter an e-mail-address. Either with the alias or without one, plain the e-mail-address.
1st possibity:
...
3
votes
1
answer
164
views
Parser and solver for percentage calculation problems
I'm working on a coding challenge to help with regular expressions, and how to write better comments in my code. The class parses a percentage question, and can return the answer.
If anyone has any ...
6
votes
1
answer
9k
views
Text cleaning script, producing lowercase words with minimal punctuation
I created following script to clean text that I scraped. The clean text would ideally be lowercase words, without numbers and at maybe only commas and a dot at the end of a sentence. It should only ...
2
votes
1
answer
100
views
Parsing airline reservation using JS regular expressions
I'm searching a set text for multiple values, which will later be stored in a database.
I am using RegExp and worked with the official documentation and help to get the code to be two separate while ...
13
votes
1
answer
44k
views
Parse complex text files using Python
I'm looking for a simple way of parsing complex text files into a pandas DataFrame. Below is a sample file, what I want the result to look like after parsing, and my current method.
Is there any way ...
4
votes
1
answer
89
views
a Python2 to Python3 print fixer in perl
Sometimes, I'm reviewing old questions written in Python2, with no parenthesis around print statements. Or I'm changing one of my older codes, also without ...
2
votes
2
answers
765
views
Parse a formatted string, which may have duplicate keys, into a map
I have a String which is coming in particular format so I want to parse that string into map. I have a below method which parses String to a Map and it works fine.
...
0
votes
1
answer
144
views
Parsing length of work experience using Composite design pattern
I want to get a number from given text (if it exists) which is about work experience in months. I assumed that number is in months when in the text one writes for example "27 miesięcy" or "27 miesiecy"...
3
votes
1
answer
242
views
Java parsing and extract String from pattern String
I want to extract some string surrounded by certain patterns.
For Instance, the original String something like 1234@{78}dasdh@{1}fdsfs@{fdf}ad@{
and I want extract ...
2
votes
1
answer
8k
views
Parse through text and extract dates in uniform format
I wrote a script to parse through text and extract all the dates. I would like it to be able to find as many different ways of writing text in dates as possible while containing as few false negatives ...
4
votes
1
answer
929
views
Matching a set of conditions based on keywords to text
I am currently working on a function that should return true or false based on a condition written in string by a user. The condition will look something like this:
...
4
votes
1
answer
4k
views
Regular Expression to Remove Comments
This was developed in response to a question on Stack Overflow, Removing comments using regex.
What the OP needed was a regular expression to use in C# to remove comnents from lines of a file. All ...
3
votes
2
answers
2k
views
Parsing very simple CSS into selector and declarations (as as single piece)
The last part of my HTML genrator requries a few styles. Because all styles are inline and the styling is for emails there won't be any fancy selectors, just by element, id or class.
The most ...
0
votes
1
answer
2k
views
Slow RegEx to parse from log file
I have the following lines to parse from a log file with 8000 lines which takes about 5 minutes to parse:
...
3
votes
1
answer
9k
views
Extracting JSON from string using regex
I need to get the value of item inside of this string and parse it as JSON. I've got some working code but I feel like it could be optimized (a lot) and cleaned up (a lot). Any tips or pointers are ...
10
votes
3
answers
1k
views
Using Python to tokenize a string in a stack-based programming language
As an avid user of esoteric programming languages, I'm currently designing one, interpreted in Python.
The language will be stack-based and scripts will be a mix of symbols, letters, and digits, like ...
3
votes
2
answers
234
views
Parsing and extracting all IDs from a document (using regex with capture)
I'm interested in parsing and extracting the IDs found in a document. The IDs are found throughout the document in the this format:
IDStart=1FG3392MQ9&IDEnd
The "1FG3392MQ9" is an example of ...
1
vote
2
answers
245
views
Phone number/email regex verifier
Is there anything I can do better here? I tried looking for ways to simplify this with comprehension but could not figure out how and was told it is better to explicitly use ...
4
votes
2
answers
9k
views
Regular expression matching with string slice in Go
I have a slice of strings, and within each string contains multiple key=value formatted messages. I want to pull all the keys out of the strings so I can collect ...
6
votes
3
answers
5k
views
Parsing a complex number using regular expressions
Requirements were to create a constructor for a complex number, that receives a string. For example: \$3+5i\$. The regex extracts positive or negative numbers from the string with optional decimal.
...
8
votes
1
answer
2k
views
RFC 4180-compliant CSV parser in Java
While looking at a recent question, I realized that there is no CSV parser in the standard Java library. I decided to write one that complies with RFC 4180. Highlights of the standard include:
...
2
votes
2
answers
2k
views
Parsing "mailto:"
Can you help me to review my "mailto:"-parsing function ?
Since I'm trying to write less code, that is as simple as possible.
I'm not sure there if there is some bug or better solution.
...
4
votes
1
answer
189
views
PHP class for reading DTD
A very long time ago, I started development of a code generator for HTML. And some time ago I rewrote it and published it under LGPL v3.0 on Sourceforge.net.
It is very universal because one of its ...
4
votes
1
answer
268
views
Solution to part 1 of Day 7 Advent of Code in Scala
Does someone want to review my solution to part 1 of Day 7 Advent of Code in Scala?
The assignment is here: http://adventofcode.com/day/7
Without repeating the whole text, in short:
Given a text file ...
11
votes
1
answer
2k
views
Tokenize s-expressions in Rust
I'm writing an s-expression tokenizer in Rust.
I have the following code written, but it is not idiomatic Rust - it is quite ugly. TokenizerI is simply an ...
8
votes
2
answers
555
views
Port of NLTK tokenizing code from Python to Rust
I'm working on a port of NLTK to Rust.
I am fairly new to Rust, so I wanted to post a small file to check if I was writing idiomatic Rust. I've included the original Python. The Python has docstrings ...
2
votes
1
answer
88
views
Parsing a component of a regex followed by an optional quantifier character
I have a piece of parsec code that parses a unit optionally followed by ?, + or ...
3
votes
1
answer
97
views
Parsing a string to an object
I have this string containing this block of code:
...
6
votes
2
answers
1k
views
Writing an IRC Bot from scratch
I have been learning C# for a couple years now, and using small projects to help myself learn. My most recent project is a complete rewrite of my first C# project that just got out of hand (the old ...
2
votes
1
answer
93
views
Parsing logs in sed efficiently
I have an application which log file has most lines start with a time/date, followed by a debugging level and the actual log message. Often I want to watch the output live and colors make it a lot ...
14
votes
2
answers
575
views
I think I might be having a regex nightmare
I've been working on the Rubberduck (an add-in for the VBA Editor /"VBE"), specifically here the VBA.Parser namespace. Here's how I ended up implementing ...
6
votes
0
answers
868
views
Parsing Lua 5.2 strings with patterns
I wrote some code to parse Lua 5.2 strings in Lua 5.1, using patterns. It works perfectly as far as I tested.
...
6
votes
2
answers
519
views
The Bucketizer Script
This code is written in a SSIS Script Component that basically accomplishes what I previously had as a T-SQL script, that was reviewed here.
I need to split a 80 character string that contains 20 ...