I have a redirect file in a pandas dataframe with a number of regex "or" expressions.
| regex_no | regex | 
|---|---|
| Regex4 | /shop/accessories/jewellery/necklaces/(brand-|)jon-richard/ | 
| Regex5 | /shop/accessories/jewellery/(bracelets|necklaces|)/brand-simply-silver-by-jon-richard/ | 
| Regex245 | /shop/(fashion/dresses/occasion-dresses|)/bridesmaid/ | 
I'm looking to build a testUrl column which builds both versions of the regex in a test url to run automated tests. It would look like this.
| regex_no | regex | testUrl | 
|---|---|---|
| Regex4 | /shop/accessories/jewellery/necklaces/(brand-|)jon-richard/ | /shop/accessories/jewellery/necklaces/brand-jon-richard/ | 
| Regex4 | /shop/accessories/jewellery/necklaces/(brand-|)jon-richard/ | /shop/accessories/jewellery/necklaces/jon-richard/ | 
| Regex5 | /shop/accessories/jewellery/(bracelets|necklaces|)/brand-simply-silver-by-jon-richard/ | /shop/accessories/jewellery/bracelets/brand-simply-silver-by-jon-richard/ | 
| Regex5 | /shop/accessories/jewellery/(bracelets|necklaces|)/brand-simply-silver-by-jon-richard/ | /shop/accessories/jewellery/brand-simply-silver-by-jon-richard/ | 
| Regex5 | /shop/accessories/jewellery/(bracelets|necklaces|)/brand-simply-silver-by-jon-richard/ | /shop/accessories/jewellery/necklaces/brand-simply-silver-by-jon-richard/ | 
| Regex245 | /shop/(fashion/dresses/occasion-dresses/|)bridesmaid/ | /shop/fashion/dresses/occasion-dresses/bridesmaid/ | 
| Regex245 | /shop/(fashion/dresses/occasion-dresses/|)bridesmaid/ | /shop/bridesmaid/ | 
Unfortunately, I've no code to show how I would approach this, as it's slightly out of my knowledge capability. Thanks
 
    