Luis
Luis

Reputation: 25

Regexextract from right not greedy

In Google Sheets, I need to extract the last occurrence date from the following text :

{"date":"2018-07-17","activeTime":10140679}{"date":"2018-07-18","activeTime":5550031}{"date":"2018-07-19","activeTime":6120026}{"date":"2018-07-20","activeTime":3150019}{"date":"2018-07-23","activeTime":5250034}{"date":"2018-07-24","activeTime":3840018}{"date":"2018-07-26","activeTime":5850060}{"date":"2018-07-27","activeTime":8670076}{"date":"2018-07-30","activeTime":870009}{"date":"2018-07-31","activeTime":30000}

I'm using the following formula :

=REGEXEXTRACT(S2;"date"":""([\d-]+).*}$")

It works but

it extract the first result and not the last.

Do you know how to extract only the last one?

Upvotes: 2

Views: 745

Answers (1)

TheMaster
TheMaster

Reputation: 50472

Just add a all consuming greedy expression (aka the .*) before your actual expression:

=REGEXEXTRACT(S2;".*date"":""([\d-]+).*}$")

Upvotes: 3

Related Questions