<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def word_count(trigger, all=False):
 """Count the words that aren't wildcards or options in a trigger. :param str trigger: The trigger to count words for. :param bool all: Count purely based on whitespace separators, or consider wildcards not to be their own words. :return int: The word count."""

    words = []
    if all:
        words = re.split(RE.ws, trigger)
    else:
        words = re.split(RE.wilds_and_optionals, trigger)

    wc = 0  # Word count
    for word in words:
        if len(word) > 0:
            wc += 1

    return wc