Category Archives: Regular Expressions

Regular Expressions in q/KDB+

The verb like is used for matching regular expressions in q/KDB+. Usage : X like Y. Reserved characters for pattern matching in q : a) “?” matches a character b) “*” matches a sequence of characters c) “[]” is used … Continue reading

Posted in KDB, Regular Expressions | Tagged | Leave a comment

Equality of Strings in q/KDB+

I came across an error and in the process of solving it discovered more about regular expressions in q. I will list the problem first. I created a fictitious table named t for the same. q)t sym price volume ——————— … Continue reading

Posted in Q, Regular Expressions | Tagged | Leave a comment

Generate all permutations in q/KDB+

My solution : perm:{[s] $[(count s)=1;s;[p:(rotate[1]\)s;raze((string first each p),/:’perm each 1_/:p)]]} Results : perm “a” “a” perm “ab” “ab” “ba” perm “abc” “abc” “acb” “bca” “bac” “cab” “cba” The kdb+ personal developers blog contains a thread on generating all the … Continue reading

Posted in Q, Regular Expressions | Tagged , | 2 Comments