Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I try to use REGEXEXTRACT on google spreadsheet but all the time I have #ERROR

I have on my cell 1-24 sur 3 964 résultats pour "patate douce"

And my regex is : (\s([0-9\s]+)\s)|(^([0-9]+)\s)|(\s+([0-9]+))

I tried my regex on regex101

When I tried the simple regex =REGEXEXTRACT(A2, "[0-9]+") given on this officiel example , I had ERROR too.

Can you help me? Thanks

Does A2 contain a string? If not, cast it to string like TEXT(A2) . Also, what are you trying to get in the end? Wiktor Stribiżew Jan 18, 2017 at 12:08 The regex works in my spreadsheet. You didn't even say what error it was: the spreadsheet gives additional information when hovering over the cell with an error. user6655984 Jan 18, 2017 at 13:01 Hi @wiktor-sreibizew, thank for your answer, I was trying your regex but doesn't work for me : screencloud.net/v/3o1S And yes I'm sur is in A2 timothylhuillier Jan 18, 2017 at 18:56

The error you get on the regex you posted lets me think you are facing a locale issue. Some locales use a semicolon (;) as an argument separator instead of a comma. So, assuming the string is A1 try

=regexextract(A1; "\s[0-9\s]+\s")

Also, see this quick example

UPDATE: I changed the formula to

=iferror(arrayformula(if(len(A1:A); regexextract(A1:A; "r\s(.+)\sré");)))
                Thanks for your help, I didn't saw my problem was (;). I'm trying your regex but I have a error : screencloud.net/v/w461
– timothylhuillier
                Jan 18, 2017 at 18:58
                @timothylhuillier: In D1 I entered =iferror(arrayformula(if(len(A1:A); regexextract(A1:A; "r\s(.+)\sré");))) See if that works ?
– JPV
                Jan 18, 2017 at 20:46