cancel
Showing results for 
Search instead for 
Did you mean: 

like: how to not match ^ in string

ag1
New Contributor
https://code.kx.com/q/cookbook/regex/

Is there a way to not match ^ in a string?

#3 works, but I would like (no pun intended) something more like #4


q)a:("aapl";"zb^a")


q)a like "*^^*"     /#1

00b

q)a like "*^*"      /#2

01b

q)not a like "*^*"  /#3, hack

10b

q)a like "*^\^*"    /#4, doesn't work as expected

'"*^\^*"

1 REPLY 1

AquaQMatt
New Contributor
Hi Ag,

Perhaps I'm misunderstanding your requirement - would something like this suffice?

q)not "^" in/: a
10b

This checks that the character "^" doesn't appear in any of the strings in the string list to the right  ->  each-right(\:)

Hope this helps!
Matt