Wild card matching characters

## Using wild card matching characters with the like operator

The like operator allows limited 'wild card' matching.
There are 2 kinds of wild card characters; a "match any" character and a "match one" character
You get to choose the character that means "match any" and the character that means "match one".
You should choose characters that are not in the string you want to look for.

Let's say you choose an asterisk to mean "match any" and a question mark to mean "match one".
Then, * matches any number of characters (including 0). For example, a*b matches ab, aXXb, aYYYYYb, etc.
? matches exactly one character. For example, a?b matches aXb and aYb, but not ab or aXYb.
Wild card characters can occur together. For example, a??*b matches all strings with at least
2 characters between a and b.

You will probably notice that the selection string you type in doesn't look much like the
the selection string you see displayed. In case you're curious, or in case you need to
type a selection into the "replace criteria" box instead of using the pick list, here's what's going on.
The 'system' "match any" character is a percent sign, and the "match one" character is an underscore
If you want to look for the % character (rather than have it represent a wild card), you
must precede it with a \. Similarly, if you want to look for _ or \ rather than have them be
treated as "special", precede either with a \. If you used the pick list, the results are
translated into the %_\ rules described above. So, your asterisks and question marks disappear,
and backslashes, percent signs, and underscores appear.

There is a bit more going on. Because the % sign has special meaning to http, it must be
"protected" to survive the trip from the web page to the data server (which is where selections
are done) If you are typing in a selection using like, when you are done, replace all % signs
with the 3 characters %25 (25 is the hexadecimal representation for the percent character).
You may again be anxious because after putting in the %25, the resulting web page still shows
a plain old percent. That is a display artifact. The JGOFS "other option" server (and, probably,
your browser as well) tend to "unhexify" things that look like %XX. It is remarkably difficult
to see what you actually typed.

Having done all that, you may end up in a few screens with a "bad trigram" error message
which includes some text which always has a % in it. Even if all the operations above
have been successfully accomplished, it's possible for there to be a problem. That's because
some data servers, which actually do the selection, don't know how to do wild cards. If you
see the like operator in the pick list, the data server from which you went to the other
option server DOES know how to handle wild cards. However, it may in turn get the data from
another data server which has problems. We are (Nov 09) working on a way around this issue

Last modified 6 Nov 09