I have below codes. Why the regular expression doesn’t work with {2}? The last 2 lines should be 1b instead. How to make it work? Thanks.
"42" like "[0-9][0-9]"; // i.e. 1b
"42" like "[0-9]{2}"; // i.e. 0b
"42" like "[0-9]{2,2}"; // i.e. 0b
I have below codes. Why the regular expression doesn’t work with {2}? The last 2 lines should be 1b instead. How to make it work? Thanks.
"42" like "[0-9][0-9]"; // i.e. 1b
"42" like "[0-9]{2}"; // i.e. 0b
"42" like "[0-9]{2,2}"; // i.e. 0b
The patterns used by like are not actual regular expressions, so they don’t support this {n} syntax. I think the naming is unfortunate.
Regular expressions in q | Basics | q and kdb+ documentation - Kdb+ and q documentation (kx.com)
kdb+ does not implement full regex.
https://code.kx.com/q/basics/regex/
It supports ?
*
[]
^
If you want full support you can use the C interface to bring in external libraries