Basic.sql 735 B

123456789101112131415161718192021
  1. /* syntax version 1 */
  2. $match = Re2::Match("[ax]+\d");
  3. $grep = Re2Posix::Grep("a.*");
  4. $capture = Re2::Capture(".*(?P<foo>xa?)(a{2,}).*");
  5. $replace = Re2::Replace("x(a+)x");
  6. $count = Re2::Count("a");
  7. -- regex to find all tokens consisting of letters and digist
  8. -- L stands for "Letters", Nd stands for "Number, decimal digit",
  9. -- see https://en.wikipedia.org/wiki/Unicode_character_property#General_Category
  10. $find_and_consume = Re2::FindAndConsume('([\\pL\\p{Nd}]+)');
  11. SELECT
  12. value,
  13. $match(value) AS match,
  14. $grep(value) AS grep,
  15. $capture(value) AS capture,
  16. $capture(value)._1 AS capture_member,
  17. $replace(value, "b\\1z") AS replace,
  18. $count(value) AS count,
  19. $find_and_consume(value) AS tokens
  20. FROM Input;