Search code examples
regexregexp-replace

Regex match any string inside quotes if its length is higher than


How i could match any string inside quotes if its length is higher than 10?

example:

"hi"
"hello"
"something_else"

Match just something_else, as its length is higher than 10.

I tried:

(["'])(?:(?=(\\?))\2.)*?\1

Could match anything inside the quotes, but I'm in doubt about how to set the min length.


Solution

  • This will do it: ".{11,}"

    For a minimum length of 11, you put {11,}

    See https://regex101.com/r/tgqec7/2