i had this string
headers: Date: schema: type: string example: Tue, 23 Aug 2022 11:36:23 GMT Content-Type: schema: type: string example: application/json; charset=utf-8 Transfer-Encoding: schema: type: string example: chunked Connection: schema: type: string example: keep-alive Content-Encoding: schema: type: string example: gzip Vary: schema: type: string example: Accept-Encoding Server: schema: type: number example: Microsoft-IIS/10.0 X-Powered-By: schema: type: string example: ASP.NET Access-Control-Allow-Origin: schema: type: string example: '*' Access-Control-Allow-Credentials: schema: type: boolean example: 'true' Access-Control-Allow-Headers: schema: type: string example: '*' Access-Control-Max-Age: schema: type: string example: '-1' Access-Control-Allow-Methods: schema: type: string example: GET, PUT, POST, DELETE X-Content-Type-Options: schema: type: string example: nosniff X-XSS-Protection: schema: type: string example: 1; mode=block content: application/json:
and i wanted to remove everything from the words headers:
to content
so I wrote this regex (headers:)[^]*?(content)
and it worked as expected finding how many times that expression has occurred.