# Assertions

{% embed url="<https://www.hackerrank.com/domains/regex?filters%5Bsubdomains%5D%5B%5D=assertions>" %}

## Positive Lookahead

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FfTpiSLRhO6dQKBlv8Lqw%2Fimage.png?alt=media&#x26;token=4c749688-7cbf-4090-b0bf-1005cec30c2a" alt=""><figcaption></figcaption></figure>

```regex
o(?=oo)
```

***

## Negative Lookahead

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FR4MFMVj7OlXhRccuUZUb%2Fimage.png?alt=media&#x26;token=f900d29f-5e69-47bb-b73b-06eba40cd9cc" alt=""><figcaption></figcaption></figure>

```regex
(.)(?!\1)+
```

***

## Positive Lookbehind

**`JavaScript do not support lookbehind.`**

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FtjiF80Dz0U5qBrkN12Ir%2Fimage.png?alt=media&#x26;token=8cebafb8-9a34-4e34-9ce9-e9bd1502f57d" alt=""><figcaption></figcaption></figure>

```regex
(?<=[13579])\d
```

***

## Negative Lookbehind

**`JavaScript do not support lookbehind.`**

<figure><img src="https://3452970062-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FhMewGT4PbQ5e1zQPC4Ko%2Fuploads%2FhNlB07ICV1gijnY4QUTa%2Fimage.png?alt=media&#x26;token=9dcd431a-c936-4ebf-9b47-3a573d2b9908" alt=""><figcaption></figcaption></figure>

```regex
(?<![aeiouAEIOU]).
```

***
