-1

I have downloaded an sql file and would like to mass replace some names of pages I have created.

This is an example of one page: {\"ref\":\"Session_1___Pg1___V2\",\"pageTitle\":null,\"description\":null,\"revealDate\":0,\"gQRef\":null,\"lQRef\":null,\"gQScore\":null,\"lQScore\":null,\"newsfeedDates\":null,\"subtitle\":null,\"pageLinkTitle\":null,\"linkTitle\":null,\"pageBack\":null,\"pagePrint\":false,\"visitedFlag\":null,\"widthPercentage\":0,\"maxWidth\":0,\"thumbnail\":null,\"edit\":null,\"copy\":null,\"delete\":null,\"preview\":null}]}

How do I search and highlight all the references of each page, just like Session_1___Pg1___V2 from above, without selecting anything else. I have hundreds of pages that I need to change the references of and I think regex would be the best way to do it with.

I used (\"((.*?))\") but it would select everything that is inbetween quotes. How do I just select the ref of the pages?

Henry La
  • 346
  • 2
  • 5
  • 14
  • Possible duplicate of [How to replace all occurrences of a string in JavaScript?](https://stackoverflow.com/questions/1144783/how-to-replace-all-occurrences-of-a-string-in-javascript) – NAVIN Aug 27 '18 at 20:12

1 Answers1

0

Use a lookbehind:

(?<=\\"ref\\":\\)"([^"]+)"
  • (?<=\\"ref\\":\\) Lookbehind for \"ref\":\ substring.
  • "([^"]+)" Matches ", opens capture group, capturing anything other than a ". Then closes capturing group and matches ".

The result is group:

Group 1.    11-32   `Session_1___Pg1___V2\`

Regex demo here.

Paolo
  • 21,270
  • 6
  • 38
  • 69