Next: Adding support for new languages, Previous: Creating themes, Up: Customizing through XML and Python files

#### 16.5.11 Defining new search patterns

The search dialog contains a number of predefined search patterns for Ada, C and C++. These are generally complex regular expressions, presented in the dialog with a more descriptive name. This includes for instance "Ada assignment", which will match all such assignments.

You can define your own search patterns in the customization files. This is done through the `<vsearch-pattern>` tag. This tag can have a number of children tags:

`<name>`
  This tag is the string that is displayed in the search dialog to represent the new pattern. This is the text that the user will effectively see, instead of the often hard to understand regular expression.
`<regexp>`
  This tag provides the regular expression to use when the pattern has been selected by the user. Be careful that you must protect reserved XML characters such as '<' and replace them by their equivalent expansion ("&lt;" for this character).

  This accepts one optional attribute, named `case-sensitive`. This attribute accepts one of two possible values ("true" or "false") which indicates whether the search should distinguish lower case and upper case letters. Its default value is "false".

`<string>`
  This tag provides a constant string that should be searched. Only one of `<regexp>` and `<string>` should be provided. If both exists, the first `<regexp>` child found is used. If there is none, the first `<string>` child is used.

  The tag accepts the same optional attribute `case-sensitive` as above

Here is a small example on how the "Ada assignment" pattern was defined.

         <?xml version="1.0" ?>
         <search>
           <vsearch-pattern>
             <name>Ada: assignment</name>
             <regexp case-sensitive="false">\b(\w+)\s*:=</regexp>
           </vsearch-pattern>
         </search>