---
title: "Discussion on \"How to run a user's regex without letting it freeze the browser tab\" | Hashnode"
description: "Discussion on \"How to run a user's regex without letting it freeze the browser tab\". If your page lets people type a regular expression and run it, one bad pattern can lock the whole tab. JavaScript's RegExp engine backtracks, so a pattern like this one\n/^(a+)+$/\n\nagainst \"aaaaaaaaaaa"
url: "https://hashnode.com/posts/how-to-run-a-user-s-regex-without-letting-it-freeze-the-browser-tab/6ae3a6976ec829459e02d2af"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [How to run a user's regex without letting it freeze the browser tab](https://a2ztools.hashnode.dev/how-to-run-a-user-s-regex-without-letting-it-freeze-the-browser-tab?utm_source=hashnode&utm_medium=feed)

If your page lets people type a regular expression and run it, one bad pattern can lock the whole tab. JavaScript's RegExp engine backtracks, so a pattern like this one /^(a+)+$/ against "aaaaaaaaaaa

Oct 29 · 4 min read · a2ztools.hashnode.dev  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#regex](https://hashnode.com/tag/regex)
-   [#web-performance](https://hashnode.com/tag/web-performance)

## Written by

[Syed Salman](https://hashnode.com/@syedsalman-a2z)

@syedsalman-a2z

  
[View profile](https://hashnode.com/@syedsalman-a2z)

Software developer. Browser APIs, Web Audio, device testing.

Software developer in Bengaluru. I write about browser APIs - Web Audio, getUserMedia, Web Crypto, requestAnimationFrame - and the small details that make browser-based tools trustworthy.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
