REGEX: Expression VS cell reference

Hi, I’m totally new to =REGEX so forgive me this noob question:

If in C2 I use formula: =REGEX(A2,B2) it returns: 2021-08-27
If in C3 I use formula: =REGEX(A3,([^","]+)) it returns: Err:507

In below example: what to type in the =REGEX formula in Expression part instead of cell reference?
Screenshot 2024-02-18 233115

Thanks

You need to put the condition inside double quotes, like a text.

2 Likes

Still messing something up :sweat_smile:

Screenshot 2024-02-18 235145

Hallo
the quotes inside the regex doesnt make sense, neither in B2 nor literally!

=REGEX(A5;"[^,]+")
1 Like

… but just FYI, if you need double quotes inside a string literal in Calc in the future: since double quote is a special character (starting / ending a string literal), its use inside a string requires escaping it - by doubling.

E.g., if the double quotes were needed in the regex (they don’t, as @karolus mentioned), then the proper formula would be

=REGEX(A5;"[^"",""]+")
1 Like

Nitpick: even if in another case a double quote would be needed in a (negated) set, listing it twice is superfluous.
:smirk: SCNR

2 Likes