Extract text between quotation marks google sheets

Viewed 7563

Looking to take a string along the lines of:

"text": "fkjhsabhfkjhs7g8ydfgd.", "e": 1541699908958, "test": true

and only extract the characters between the text field...so end up with only fkjhsabhfkjhs7g8ydfgd.

The length of the text field can vary

Tried this: =REGEXEXTRACT(C2,"""(.*?)""") with no luck

3 Answers

I found that if you escape the double double quotes, that it works. The other examples don't appear to work in Google Sheets regexextract function

=REGEXEXTRACT(C2,"\""(.*?)\""")

An alternative solution could be

=regexextract(C2, "\:\s""(.+?)""")

I'm not sure if Excel does capture groups properly, but if your input has no double quotes inside, you could try:

=REGEXEXTRACT(C2, "[^""]+")

which matches up to the second double quote (eg. matches abc in "abc"d").

Related