{hero}

search.regex

Since: DataTables 1.10

Enable / disable escaping of regular expression characters in the search term.

Description

Regular expressions can be used to build fantastically complex filtering terms, but also it is perfectly valid for users to enter characters such as * into the filter, so a decision needs to be made if you wish to escape regular expression special characters or not. This option controls that ability in DataTables.

It is simply a flag to indicate if the search term should be interpreted as a regular expression (true) or not (false) and therefore and special regex characters escaped.

Type

This option can be given in the following type(s):

Default

  • Value: false

Example

Treat search inputs as regular expressions:

new DataTable('#myTable', {
	search: {
		regex: true
	}
});

Related

The following options are directly related and may also be useful in your application development.