Reputation: 63
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
Reputation: 1
Change A1 with your designated cell number and it should work
=REGEXEXTRACT(A1,"""(.*?)""")
Upvotes: 0
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
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