Home > Fluid Dynamics Search Engine > Help > 1143

Wildcard (asterisk *) behavior and how to customize it

Default behavior

The * character will match 0 to 4 non-whitespace characters.

The wildcard will only be allowed in keywords which contain at least three non-asterisk characters. If there are fewer than three other characters, then the keyword will be ignored.

Back-to-back wildcards will be collapsed to a single wildcard, so foo*bar and foo**bar are equivalent.

Examples:

Counter-examples:


Customizing the behavior

The FDSE General Setting "Wildcard Match" contains a Perl regular expression that is used in place of the * character.

The default, "\S{0,4}", will match zero to 4 non-whitespace characters. To match any character, including whitespace, use ".{0,4}" (that will allow bit*it to match "bite it"). To match 0 to 100 characters, use ".{0,100}" (that allows wish* to match "wishy-washy").

The wildcard was originally limited to a low number of matches -- like 4 -- to improve performance. The code has not been recently benchmarked to determine whether that limit is still necessary.

If you wish to change the number of non-asterisk characters required for each valid keyword, you will need to edit the source code. Find library file "common.pl" in the "searchmods" folder and locate the following code:

	# Ignore wildcard-enhanced terms with less than 3 real characters:
	if ((m!\*!) and ((length($_) - (s!\*!\*!g)) < 3)) {
		$type = 0;
		}

Simply change the number "3" to your desired limit. You must have some limit. The minimum possible is 1.


Updating the search tips

In all FDSE releases through 2.0.0.0055, the default tips.htm file contained the following help text related to wildcards:

"By typing an * at the end of a keyword, you can search for the word with multiple endings; Example: Try wish*, to find wish, wishes, wishful, wishbone, and wishy-washy."

This help text was inaccurate in that 1) wildcards can appear anywhere within the word, not just the end and 2) the wish* == wishy-washy example is incorrect since only up to 4 characters can be matched.

As of FDSE 2.0.0.0056, the default tips.htm help has been changed to:

"By typing an * within a keyword, you can match up to four letters; Example: Try wish* to find wish, wishes, or wishful."

If you had originally installed FDSE build 0055 or older, then you will need to manually update your search tips to contain the correct help (since upgrades do not overwrite the tips.htm template).

Also, if you change the behavior of FDSE, like allowing more or fewer characters to match the wildcard, then you may want to update your help file to reflect that.


Escape sequence

FDSE searches only alphanumeric text, not punctuation. Therefore, there are no cases in which FDSE would be able to search for literal "*" and so no escape sequence is supported.


Related topics


    "Wildcard (asterisk *) behavior and how to customize it"
    http://www.xav.com/scripts/search/help/1143.html