In Dynatrace, there are the URLs which are containing the a word which is dynamic. Want to remove that dynamic word from the URL using regex
Below are the different urls
- /aaa/fdsadx/drtyu/ab_cd/myword?Id=953
- /asd/XXXXX/sadsa/two/xx_yy?Id=953
- /asd/fdsadx/df/three/pp_qq/myword
- /asd/fdsadx/sadsa/ab_cd
- /SSS/fdsadx/cvnm/forth/gg_hh
Expected output
- /asd/fdsadx/sadsa//myword?Id=953
- /asd/fdsadx/sadsa/?Id=953
- /asd/fdsadx/sadsa//myword
- /asd/fdsadx/sadsa/
I'm able to manage this regex
(\S+?)ab_cd(.*)
But its not working for dynamics values and all URL. How Can I improve the regex to to remove the dynamic value?