# REGEXTEST

## Content

## Summary

The REGEXTEST function allows you to check whether any part of the supplied text matches a regular expression ("regex"). It returns TRUE if it does, and FALSE if it doesn't.

## Syntax

```javascript
=REGEXTEST(text, pattern, [case_sensitivity])
```

## Arguments

| Argument | Description |
| -------- | ----------- |
| **text**<br>(required) | The text or the reference to a cell containing the text you want to match against. |
| **pattern**<br>(required) | The regular expression ("regex") that describes the pattern of text you want to match. |
| **case\_sensitivity** | Determines whether the match is case-sensitive.<br>**0:** (default) Case sensitive<br>**1:** Case insensitive |

## Remarks
Return: `TRUE` or `FALSE`. The regex test result.

## Examples

```auto
=REGEXTEST("abc","a") // TRUE
=REGEXTEST("abc","[A-Z]") // FALSE
=REGEXTEST("abc","[A-Z]", 1) // TRUE
=REGEXTEST("abc","[0-9]") // FALSE
```

> The REGEXTEST function is compatible with Excel's REGEXTEST. At the same time, the previous version of the SJS.REGEXMATCH function has been deprecated, while maintaining backward compatibility. A list of differences between the two functions is as follows:

|  | **REGEXTEST Function** | **SJS.REGEXMATCH Function** |
| --- | ------------------ | ----------------------- |
| argument types | Only supports 0 or 1 to specify if the match is case-sensitive.<br>`=REGEXTEST("abc","[A-Z]", 1)` | Uses the string modifier.<br>`=SJS.REGEXMATCH("abc","[A-Z]", "i")` |
| match in multiline | Only regex matching can be used<br>`=REGEXTEST("abc`<br>`ABC","\n[A-Z]")` | Can work with the modifier “m”<br>`=SJS.REGEXMATCH("abc`<br>`ABC","^[A-Z]","m")` |
| process non-string arguments | Accepts all types.<br>`=REGEXTEST(2024,24)` | Returns the #VALUE! for the non-string input. |
