| Syntax 
   do scan string-expression
     (match pattern condition?
        local-declaration*
        action*)+
     (else
        local-declaration*
        action*)?
  done
 Purpose
 
 This scanning action specifies a number of matchalternatives, each of which contains a sequence of actions to be performed if the value of the specified string expression matches the given pattern. Theelsephrase is optional. Only oneelsephrase may be used in ado scanaction. The actions in a matchalternative are performed if the pattern matches all or part of the string expression. Each time amatchalternative is tried, the pattern matching begins again at the beginning of the data to be scanned. If a matchalternative specifies a condition, then the condition must also be satisfied before the actions in that alternative will be executed. A final sequence of actions can be preceded by the keyword else. Actions in theelsecondition will be performed if none of the other match alternatives are selected. The following is a fairly standard do scanaction that uses anelsephrase. If the value of the "color" attribute is not black, gray, or blue, then theelsephrase is selected:
   do scan "%v(color)"
    match ul "black"
      output "\background(black)"
    match ul "gray" | ul "grey"
      output "\background(gray)"
    match ul "blue" | ul "cyan"
      output "\background(cyan)"
    else
      output "\background(black)" ; default color
  done
 |