All Questions
230
questions
3
votes
1
answer
89
views
Build a dictionary from a string by the extraction of data from all the pairs <TAG|VAL> contained inside the string and clean string from TAGs
I have written code to manage a string and retrieve from it a dictionary which must contain pairs key-value dependent from the string.
To be more clear I'll show ...
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 ...
4
votes
4
answers
3k
views
A function that uses a regex to parse date and time and returns a datetime object
The code works, but I think can be simplified, I don't know which specific steps, but my version seems to me quite complicated
I build a function that takes a specific string format and returns a <...
10
votes
4
answers
4k
views
Determine age from given birth date
So this is my first ever attempt so it's obviously bad. There has to be a better way to do this. A big thing I haven't implemented is trying to guarantee the structure of the input(i.e making sure ...
0
votes
1
answer
168
views
Password policy with regex and zxcvbn
This code snippet shows an implementation of a password policy check.
- The method composition uses regex to verify that the password meets composition criteria (at least one number, one special ...
2
votes
1
answer
317
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
1
answer
108
views
Newspaper Bill Calculator CLI with Python (1 of 3, Core)
Code is posted after explanation.
Due to the size of the project, this is being posted in three separate posts. This also ensures each post is more focused.
Post 2 of 3, CLI: Newspaper Bill ...
2
votes
2
answers
115
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 ...
2
votes
1
answer
131
views
Regex pattern matching to generate pandas multi index
Mostly just looking for a review of my regex and implementation of capture groups. its something I've been working to improve.
The indexes have somewhat of a pattern to them of being....
...
5
votes
1
answer
1k
views
Breaking Bad name generator
I've created a script to print all periodic table symbolic permutations of a string. As seen in the opening credits of each episode of Breaking Bad:
© 2010-2022 AMC Networks Entertainment LLC.
...
2
votes
1
answer
248
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:
...
7
votes
2
answers
1k
views
Automate the Boring Stuff CH 7: password strength test
This exercise comes from Automate the Boring Stuff Ch 7. The assignment is to use regular expressions to test the strength of a password. Password must be >= 8 characters, contain at least one ...
0
votes
2
answers
117
views
Python function for finding if all substrings exist in a string in sequence
I want to find if all of a list of substrings exist in a string, in the correct order (with or without spaces between them), it seems to be a good use for regex.
I think I need to build a regex ...
1
vote
1
answer
126
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 ...
8
votes
3
answers
1k
views
Filter out ambiguous bases from a DNA sequence
I have this function:
...