String Parsing with Regular Expressions and Python

Job ID: 31170532

Budget: $30 – $250 USD

Hello,

I have a large dataset of strings that I need to be parsed into usable information.

I would like for this to be done using REGULAR EXPRESSIONS within PYTHON.

Some example strings are as follows :

<>START EXAMPLES<>

2 times per week for 25 Weeks

Maintenance Frequency - 1 times per month

Custom Frequency: 2x/month for 6 months

Moderate Frequency: 2 times per week for 25 Weeks Not to exceed 50 visits and re-evaluations as appropriate. Make-up visits may be completed within the certification period which may result in additional visits performed during a given week

<>END EXAMPLES<>

For each line I need to know the Frequency per unit of time for duration unit of time
So ideally I would have an end result , per line, like the following :

result = {
"frequency":2,
"frequency_unit":"Week",
"duration":25,
"duration_unit":"Month"
}

This is a classic situation where there was no real regulation on how data was entered and now the company wants to automate processes on inconsistent data. You're helping me by making the information usably consistent for the rest of the application downstream.

This again must be made in PYTHON 3.x and Regular Expressions.
Related categories: Python Regular Expressions