Apr-20-2020, 06:06 PM
I'm writing an application with a configuration file that contains a regex expression, such as "KEY=(\w+)" which will extract the first word (in this case FRED) in an expression such as "KEY=FRED ETHEL". This the entry in the config file is:
RULE = KEY=(\w+)
The input files I'm interpreting are very highly structured, so the keys are always in a specific format.
So, it may be there are multiple keys, such as "KEY1=FRED ETHEL" & "KEY2=LUCY RICKY", and to get just the girls names, I'd set the RULE as so:
RULE = ["KEY1=\w+\s(\w+)", "KEY2=(\w+)"]
However, if I use the config parser to read that in, it's interpreted as type=str and not as type=list. Does anyone know of a clever way to have that value interpreted as a list, rather than a string, as appropriate? ./Taras
RULE = KEY=(\w+)
The input files I'm interpreting are very highly structured, so the keys are always in a specific format.
So, it may be there are multiple keys, such as "KEY1=FRED ETHEL" & "KEY2=LUCY RICKY", and to get just the girls names, I'd set the RULE as so:
RULE = ["KEY1=\w+\s(\w+)", "KEY2=(\w+)"]
However, if I use the config parser to read that in, it's interpreted as type=str and not as type=list. Does anyone know of a clever way to have that value interpreted as a list, rather than a string, as appropriate? ./Taras