According to Google Query documentation:

matches - A (preg) regular expression match. haystack matches needle is true if the regular expression in needle matches haystack. Examples: where country matches '.*ia' matches India and Nigeria, but not Indiana. Note that this is not a global search, so where country matches 'an' will not match 'Canada'.

I tried to use it in the formula =query('Общий список'!A3:V;"select * where B matches '/[A-Z]+/' "), but the query returns empty output.

Reference: https://developers.google.com/chart/interactive/docs/querylanguage#Where

  • Have you tried it without the forward slashes? – Tom Horwood Dec 12 '13 at 21:17
  • yep, same result. – Gleb Dec 12 '13 at 23:03
  • 1
    Why don't you share a doc with us? – Jacob Jan Tuinstra Dec 15 '13 at 21:03
  • I just realised that the sheet title is cyrillic. You may need to add an extra range for the upper case Russian(?) characters. – Tom Horwood Dec 30 '13 at 23:40

Note that this is not a global search...

This sentence explains what is going on: unlike the match in regexmatch, the matches clause of Query language requires the entire string to match the given regular expression. So, if you want to match strings where some part matches a regular expression re, the regular expression should be wrapped in .*:

select * where A matches '.*re.*'
| improve this answer | |

Just a guess, but OP may want something like this:

=query(A:A, "Select A where A matches '.*/[A-Z]+/.*' ")  

to select from ColumnA only cells containing nothing but Latin alphabet upper case letters between two virgulas suspensiva (forward slashes) whether or not in the context of other characters.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.