joe rodney
joe rodney

Reputation: 63

Extract text between quotation marks google sheets

Considering the string shown below:

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

I am trying to extract the value of the field named "text". Essentially, from within the string, I would like to capture the sub-string shown below:

fkjhsabhfkjhs7g8ydfgd

The length of the value of the field named "text" is not constant, it could vary.

I tried with this regex:

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

I did not get what I am after. Any help would be appreciated!

Upvotes: 5

Views: 11770

Answers (4)

Raihan Rahman
Raihan Rahman

Reputation: 1

Change A1 with your designated cell number and it should work

=REGEXEXTRACT(A1,"""(.*?)""")

Upvotes: 0

Greg Griffin
Greg Griffin

Reputation: 81

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,"\""(.*?)\""")

Upvotes: 8

JPV
JPV

Reputation: 27262

An alternative solution could be

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

Upvotes: 3

Carol Ng
Carol Ng

Reputation: 575

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").

Upvotes: 2

Related Questions