How to get strings after specific patterns

Try this regex:

searchUniqueCode\("name",\s*"\K[^"]+

Click for Demo

Check code here


Explanation:

  • searchUniqueCode\("name", - matches searchUniqueCode\("name",
  • \s*" - matches 0 or more occurrences of a white-space followed by a "
  • \K - un-matches whatever has been matched so far and starts the match from the current position
  • [^"]+ - matches 1 or more occurrences of any character that is not a ". This is the desired match that will match everything until the next occurrence of "

Or

You can capture the desired values in group 1 as shown below:

searchUniqueCode\("name",\s*"([^"]+)" - Working code here