All Questions
Tagged with regex python-3.x
73 questions
4
votes
1
answer
88
views
Polynomial parsing using regular expressions in Python
I've made a code in Python 3 which converts a polynomial with integer coefficients (in simplified integer form) from string form to a list of tuples of the form (coefficient, exponent, variable). It ...
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 ...
6
votes
2
answers
221
views
Sort todo.txt items by due date in Python 3
I am using the following format for my task management: https://github.com/todotxt/todo.txt
Do some stuff +uni due:2022-12-31
Write some paper +uni due:2023-01-10
...
1
vote
1
answer
5k
views
A python script to download video from a website
I wrote this script for gaining experience, this script takes in a website link (NSFW) and download the video on that site. It uses regular expressions to parse the website source code to extract urls ...
1
vote
1
answer
182
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
2
answers
140
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 ...
3
votes
1
answer
80
views
Replace badly formatted questionnaires in a document using regex
I have rather badly formatted questionnaires (i.e. ordered lists) in a bunch of documents that I want to clean up and replace the current version with the cleaned-up version.
Example text
...
2
votes
1
answer
144
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.
...
8
votes
3
answers
2k
views
Filter out ambiguous bases from a DNA sequence
I have this function:
...
7
votes
1
answer
442
views
Stop cheating on home exams using python
Background
I am teaching a course at university level, and have lately been working on creating a home exam for my students. However, the institute has given clear instructions that collaboration is ...
4
votes
1
answer
403
views
Regex to match several slightly different strings
I work with a charity that does a number of jobs, more than 100, less than 1000 a year. Jobs are identified with a year, and an up to 3 digit serial number, so ...
2
votes
4
answers
307
views
A simplified regular expression matcher
I am working my way through some code challenges — partly to improve my problem solving, but also to improve my code quality.
I think my current (fully-functional) solution to a challenge is pretty ...
4
votes
1
answer
4k
views
Finding Pattern Score in Python
I saw this problem in C++ on here and decided to try it in Python, which was much simpler. I've used the same problem blurb as in the link above, so they are consistent. I'm sure my code can be ...
3
votes
2
answers
2k
views
Date Detection with Python RegEx
its a practice project from "Automate the Boring stuff with Python" book. i am an intermediate level Python programmer and i tried to solve this problem with less code as possible. This code ...