Bugzilla Tips (IV): Searching for empty fields

This posting is part of a series on small and sometimes not-so-easy-to-discover functionality in Bugzilla that makes developers’ and users’ lifes more comfortable. It’s based on conversations with users and developers in the last months.

Sometimes you want to search for a specific field being empty, e.g. bug reports without anybody on the CC list.
If you go to Bugzilla’s advanced search and scroll down to the “Custom Search” (called “Boolean Search” in older Bugzilla versions), you can use “matches regular expression” and respectively “does not match regular expression”. Regular expressions (regexes) are powerful patterns to match a certain string (the corresponding Wikipedia article provides more information).

To find all bug reports that have no keywords, enter this:

Keywords | matches regular expression | ^$

^$ is the regular expression for an empty string.

As written before, regexes are very powerful. For example, you could also search for comments in Bugzilla that contain inline Git-formatted patches by using Comment | matches regular expression | —[[:space:]].+[[:space:]]\+\+\+[[:space:]].+[[:space:]]@@[[:space:]].+@@[[:space:]]

Comment | matches regular expression | ---[[:space:]].+[[:space:]]\+\+\+[[:space:]].+[[:space:]]@@[[:space:]].+@@[[:space:]]

As can be seen, the MySQL database requires using [[:space:]] instead of \s for a whitespace character, see its documentation.

One Response to “Bugzilla Tips (IV): Searching for empty fields”

  1. aklapper says:

    Just realized that this will be fixed for Bugzilla 5.0: https://bugzilla.mozilla.org/show_bug.cgi?id=345194