Skip to main content

All Questions

Tagged with
Filter by
Sorted by
Tagged with
6 votes
2 answers
713 views

Weather Observation Station 8 query

Here's my (correct) solution to a HackerRank question: Weather Observation Station 8 Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last ...
JTB's user avatar
  • 277
2 votes
2 answers
151 views

Faster regex to match all worded numbers from 1 to 99

I would like to know if there is a better regex to match all worded numbers from 1 to 99. With "better" I mean shorter with same performance, OR faster. I came up with this. I can't do ...
Bobby234's user avatar
4 votes
4 answers
2k views

Matching words from a text with a big list of keywords in Python

I implemented the following code to retrieve medication names from a given text (prescription_text in the code). It works by matching words in the text with a list ...
cuzureau's user avatar
  • 191
0 votes
1 answer
93 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? ...
ericraio's user avatar
  • 151
1 vote
2 answers
328 views

Replacing banned words from a given text

The following algorithm is used to find a word from Blacklisted words in a string (called text) and replace these words with censored text, as shown in the example. Example: ...
TomaszOleszko's user avatar
2 votes
1 answer
261 views

Extract regular words from string but retain all other elements and record their type

This snippet processes every regular (\w+) word in a text and reinserts the processed version: ...
Alex Povel's user avatar
  • 1,226
0 votes
1 answer
68 views

function to check if anchor tags contain href attributes with 301

I made this function to test if the content has 301 redirections.. Please can you help me optimize it better because it's too slow ...
s_a_i_d's user avatar
2 votes
2 answers
923 views

Replace string based on multiple rules, don't replace same section twice

Given a 2-column CSV dictionary file that contains translation of certain words, this c# code needs to replace the first occurrence of a word in the dictionary. Once a segment of string has been ...
A_V's user avatar
  • 183
2 votes
1 answer
63 views

Optimizing a script that switches function arguments in code files

I made a quick script, that inputs file paths(made for C files), function names and 2 indexes. The script goes over all of the files and switches the indexes of the 2 functions. e.g.: Running the ...
Harton's user avatar
  • 33
8 votes
3 answers
686 views

Function in Python to extract web Data

I developed this feature that I think can be improved quite a bit. The result is the desired one, but it took me many lines of code. Any idea to optimize it? ...
Raymont's user avatar
  • 215
1 vote
2 answers
3k views

Regex to match each line in a file, with windows and/or linux line break included, even for missing line break at EOF

My requirement is to match each line of a text file, including the line terminator of each, at most excluding the terminator of the last line, to take into account the crippled, non POSIX-compiant ...
Enlico's user avatar
  • 517
3 votes
1 answer
473 views

Parse and format var_dump data to become more readable

I have a class that exposes var_dump data in order to get better human readable layout. I have achieved this with a lot of ...
Minos Framework's user avatar
1 vote
2 answers
1k views

Tokenizing a large document

I'm currently trying to process a corpus of a million patent text files, which contain about 10k non-unique words on average. My current data pipeline works as follows: Load the patent texts as ...
warmbadetag's user avatar
1 vote
3 answers
1k views

Check browser compatibility for RequestAnimationFrame and Vanilla JavaScript .animate() API

I'm trying to set up some code to first test if the Vanilla JavaScript .animate() API is Supported, then if it's not check if ...
Ryan Stone's user avatar
3 votes
3 answers
176 views

Java regex and replaceAll to extract strings into objects

I have this method that creates book objects. I pass a list of strings (size 60000+) that contain the information of the book, the function then goes and extracts the information makes the book object ...
Rob's user avatar
  • 63

15 30 50 per page
1
2 3 4 5
7