Forum Discussion
Remove strings within parentheses from Power Query Editor
- 7 years ago
ELW ,
An simple way than power query is to write a python script to replace (...) using non-greedy matching.
# 'dataset' holds the input data for this script import pandas as pd dataset["AFTER"] = dataset.replace(to_replace=r'\(.*?\)', value='', regex=True)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
ELW add new custom column in power query with following expression
Text.Replace(Text.Replace([BEFORE],"(",""), ")", "" )- ELW7 years ago
Advocate II
Thanks parry2k! I believe that just replaces the parentheses themselves while leaving the text inside them. Is there a way to modify that formula to remove the text from inside the parentheses as well?
- v-yuta-msft7 years ago
Community Support
ELW ,
An simple way than power query is to write a python script to replace (...) using non-greedy matching.
# 'dataset' holds the input data for this script import pandas as pd dataset["AFTER"] = dataset.replace(to_replace=r'\(.*?\)', value='', regex=True)
Community Support Team _ Jimmy Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.