---
name: "ausearch_add_regex"
section: "3"
platform: "linux"
package: "audit"
version: "4.2.1-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/ausearch_add_regex"
---

# ausearch\_add\_regex(3)

use regular expression search rule

## NAME

ausearch\_add\_regex - use regular expression search rule

## SYNOPSIS

**#include \<auparse.h\>**

**int ausearch\_add\_regex(auparse\_state\_t \****au,***const***char***\*"***regexp);"*

## DESCRIPTION

ausearch\_add\_regex adds one search condition based on a regular expression to the current audit search expression. The search conditions can then be used to scan logs, files, or buffers for something of interest. The regular expression follows the posix extended regular expression conventions, and is matched against the full record (without interpreting field values).

If an existing search expression *E* is already defined, this function replaces it by **(***E* **&&** *this\_regexp***)**.

## RETURN VALUE

Returns -1 if an error occurs; otherwise, 0 for success.

## SEE ALSO

[**ausearch\_add\_expression**(3)](/ausearch_add_expression/3.md), [**ausearch\_add\_item**(3)](/ausearch_add_item/3.md), [**ausearch\_clear**(3)](/ausearch_clear/3.md), [**ausearch\_next\_event**(3)](/ausearch_next_event/3.md), [**ausearch\_cur\_event**(3)](/ausearch_cur_event/3.md), [**regcomp**(3)](/regcomp/3.md).

## AUTHOR

Steve Grubb
