-2

In my Java project I need to match the next text. I use WireMock to stub request. So I need to write regex to find desire requests and return stub response. In WireMock I need to write regex to intercept http requests.

Suppose I has 2 jsons:

{                                                                                                                                                                                                                                            
    "action": "Handler:GET_DICTIONARY",
    "locale": "en",
    "data": {"dictionary_type":"EXCHANGE_RATES_AS_DICTIONARY"}
}

and

{                                                                                                                                                                                                                                            
    "action": "Handler:GET_DICTIONARY",
    "locale": "en",
    "data": {"dictionary_type":"MTS"}
}

I need to select only second json by regexp. The unique text to identify second json are:

on first line: GET_DICTIONARY

AND

on third line: MTS

What is a correct regexp for this?

I try this regexp but it not help:

GET_DICTIONARY\(.*\r\n\)\{2\}.*MTS
Alexei
  • 14,350
  • 37
  • 121
  • 240

1 Answers1

-2

here Demo

try this

GET_DICTIONARY(.*\n){2}(.*MTS.*)
Akash Shah
  • 596
  • 4
  • 17