I am trying to make a regex for JS. following are inputs
PREFIX hello SUFFIX
PREFIX PREFIX SUFFIX
PREFIX SUFFIX SUFFIX
PREFIX var+2 SUFFIX
Note: PREFIX and SUFFIX are kind of fixed. in between these words, we can have any number. of words.
I came up with this regex
(PREFIX(?=(?<spaces>[sS]+SUFFIX))k<spaces>)
but this one was reported as polynomial
https://regex101.com/r/YCbU0f/1 has attack string which causes more backtracking.. Can we make it safe from tool above meeting above requirements.