Showing results for 
Show  only  | Search instead for 
Did you mean: 

This product reached the end of support date on March 31, 2021.

create a regex for pattern

Hello Friends

Can someone help me create a regex or transformation regex to achieve below pattern please. I am new to create this regular expression



Dynatrace Pro
Dynatrace Pro

Hi Girish,

when designing a regular expression you need to know two things:

a) What is your input set

b) What is the desired outcome

Your example gives us an idea of what a part of your input set might look like, but we don't know what the pattern is that the other strings in that set follow, or if there is one.

Then, what would you like the regex to do? Find exactly this string? Or find all key/value pairs that start with RTR and extract their value? It would be best if you explained what your aim is in a bit more detail.

Best regards,


Hi Peter

I want to find the string above. However this query string will have few dynamic value. Below is the details around it.

Kindly advise.

  1. RTRRtf=GotoView&RTRView= - This is the standard text which will be part of each query
  2. RTE_DFD+James+Testy+-+Prop+Items+Testerpart+View - This will change each time depending on user landing page
  3. &RTRTR=1&RTRHo= - This is standard text in the query
  4. - This denotes the application web address (Ex - (on denotes the application hosted location - whcih is ontario)
  5. &RTRUP=1&RTRPrompt0= - This string is standard
  6. GFT+7Dn+Yorky+Ytest+Preview+Form+Promot - this is basically the sub section of a web page. This will change based on user landing page
  7. &RTRRowId0= - This is constant string
  8. 1-4RRR444 - Dynamic. this will change depending on the row number in a table that user is working.
  9. &RTRPrompt1= - This is the second sub section of a web page . this will not change. RTE_DFD+James+Testy+-+Prop+Item+List+Prompt+(Rdddd) - third sub section of a page -
  10. &RTRRowId1= - This is same as RTRRowId0
  11. 1-5RRR1 - This could dynamic

A query will have

  • 1 RTRRtf=GotoView&RTRView= (value will be dynamic)
  • 1 &RTRTR=1&RTRHo= (Value is dynamic)
  • 1 - This can be either or
  • 1 &RTRUP=1&RTRPrompt0= -(Value of this is dynamic again)

Starting from here. a query ca have multiple RTRPrompt and RTRRowId. If RTRPrompt are 3 (Ex - RTRPrmopt0/1/2.. then associated RTRRowId will be there (like RTRRowId0/1/2..)

Dynatrace Pro
Dynatrace Pro

Hi Girish,

thanks for the details. The first rule of regex, generally, is to not use them unless absolutely necessary, as they can be a bit of a performance issue.

In your case, is there a reason why a "starts with: RTRRtf=GotoView&RTRView=" wouldn't work? I.e., is there a lot of similar queries and you're only interested in a specific subset of them?

Or is this query string a substring of some longer string that you'd like to extract via a transformation regex? Then we'd need to know what the string looks like before and after the part you're interested in. Best regards,


Hi Peter

Sorry for delayed response.

Using only RTRRtf=GotoView&RTRView=" , It would not work as there are dynamic content in the query string.

This is the query string for a specific screen or a page. This string will have common parts for each page. for example - 1, 3 and 5 are always static. 2,4 and 6 are always dynamic because, these are value for 1,3 and 5.

Depending on where user is navigating in a screen, 7 and above would pop up.

ok, but all of them _start_ with the fixed text RTRRtf, right? So instead of making a regex you could simply use a "starts with" criterion, or am I misunderstanding your requirements?

Otherwise, an example regex could look like this:


the first .*? would mask stuff like GotoView (if there could be other strings in that place). The last .* will match the rest of the query.

The dot matches any character, the asterisk repeats the match and the question mark tells it to be non-greedy (i.e. only match till the next part of the regex occurs).

Experiment a bit with this and let us know if you need more details, cheers,


Hey Girish, Also note, you cannot modify the data captured by regex, you can only capture and split. I hope I am clear.

Regards, Rajesh