paint-brush
Avoid Stack Overflows By Writing Regexes Properlyby@sonarsource
860 reads
860 reads

Avoid Stack Overflows By Writing Regexes Properly

by SonarSource4mFebruary 23rd, 2021
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

Regular expressions are a powerful mechanism for matching patterns in strings. But matching a pattern may - depending on the pattern - require stack space proportional to the length of the input. This means large inputs could cause the program to crash with a stack overflowException. To prevent this, we have a rule that warns you about issues like this: Regular expressions should not overflow the stack. The rule tries to estimate how much stack space a regular expression will consume relative to the input size. It only raises issues on regular expressions whose stack consumption exceeds a configurable threshold.

Company Mentioned

Mention Thumbnail
featured image - Avoid Stack Overflows By Writing Regexes Properly
SonarSource HackerNoon profile picture
SonarSource

SonarSource

@sonarsource

We build world-class Code Quality & Security tools: SonarQube, SonarLint and SonarCloud

L O A D I N G
. . . comments & more!

About Author

SonarSource HackerNoon profile picture
SonarSource@sonarsource
We build world-class Code Quality & Security tools: SonarQube, SonarLint and SonarCloud

TOPICS

THIS ARTICLE WAS FEATURED IN...

Permanent on Arweave
Read on Terminal Reader
Read this story in a terminal
 Terminal
Read this story w/o Javascript
Read this story w/o Javascript
 Lite
Also published here
Aiois