(wcmatch string pattern)
Search that string.
This function finds internal string matches. You can see if a certain string is found, or match it with another string.
For example, if you had a string variable called MYVAR which contained the string "SUPERCALIFRAGILISTIC123\##" and you wanted to see if the characters "FRAG" were anywhere in the string you could use the wcmatch function, as follows:
- (wcmatch MYVAR "*FRAG*")
If a match is found, wcmatch returns T. If no match is found, nil is returned. The wcmatch function is case-sensitive. To find a match, you should use strcase to change everything to uppercase if necessary.
You can use several wildcards for wcmatch:
| Wildcard | Definition |
|---|---|
| ~ | (tilde) Pattern not found in string. |
| * | Standard wildcard; can be used anywhere. |
| ? | Matches for a space held by a character or number; number of question marks (?) must exactly match number of characters or numbers in the string. |
| # | (pound) Matches any single number. |
| @@ | Matches any single character; may not be a number. |
| . | (period) Matches any single non-alphanumeric character. |
| (space) Matches one or more spaces. | |
| [ ] | Matches for any of the characters enclosed in the brackets. |
| [~ ] | True only if there are extra characters not included in the brackets. |
| [ - ] | (hyphen) Searches within a predefined range pattern. |
| , | (comma) The "or" option. |
| ' | (reverse quote) Read next character literally; use for special characters. |
Examples
| Code | Returns | Comments |
|---|---|---|
| (setq N "11234 TROPICANA AVE.#@") | ||
|
|
||
| (wcmatch N "~345") | T | "345" is not found in the pattern. |
| (wcmatch N "*opic*" ) | T | "opic" is found with anything before and after. |
| (wcmatch N "?????????????????????") | T | There are 21 characters, numbers and spaces in this string. |
| (wmatch N "#####*") | T | Matches 5 digits, followed by anything. |
Tell me about...
(setq symbol1 statement1 [symbol2 statement2] ...)
en
italiano
čeština
Deutsch
français
hrvatski
magyar
polski
српски
русский
中文
中文
한국어
español