I'm trying find all occurences of this in one of my fields--
3(a)(3)
Only thing is, the spelling might also be:
3[a][3]
Or other, non-alpha characters between the threes and the "a". I'd like to cull together a search to handle those possibilities, but don't know the proper REX terminology. Can't use \alpha, for example, since parens or brackets or curly brackets don't fall under it's purview.
Can I ask another, related question? Regarding when to escape REX characters.
Say I have some text like this:
a-2-p-2
I want to search it using tsql, so myself, I'd do something like this:
tsql "select * from mytable where myfield like 'a-2-p-2'";
However, I'm not sure if I have to escape those minus signs with backslashes? I didn't invoke REX above, since I didn't use a forward slash at the beginning of my term, so I'm not sure if I have to escape anything.
What if I want to match exact text in my field, should I enclose the term above in double-quotes, eg:
tsql "select * from mytable where myfield like '\"a-2-p-2\"'";
Or is that not enough and I have to do something else? Thanks again.
You only have to escape things when they would be considered "special". Using quotes is not the same as escaping with \. Quotes just bind phrases.
myfield like 'a-2-p-2'
will look for the phrase "a-2-p-2" hyphens and spaces will be treated identically in regular terms unless you turn off hyphenphrase. In rex hyphen and space are distinct.
Hmm. Well, I tried that, and got hits back which with "a-2/p-2". No doubt because hyphenphrase was on. Is it possible to turn it off when I run a tsql command, or is that only a possibility with a vortex script?
I'm having a little trouble with using {0,1}. If I run a search like so:
select TITLE from mytable
where TITLE like '/a[\.\-_\space]{0,1}2'
I get hits back which don't make sense-- almost anything will come back, and nothing with a "2" in the field. If I put something else in the curly brackets, get rid of the zero, maybe just use a {1}, things work fine. Did I do something wrong? Obviously yes.
I'd hoped for values like "a-2" "a.2" "a 2", that kind of thing.