There is a regex /\[(.{1,255})\]/g \\\\ ( /\[(.{1,255})\]/g [abc]def[xyz] and a line [abc]def[xyz] . I would like regex to return [abc] and [xyz] , but it goes [abc]def[xyz] . Chyadt?

    1 answer 1

    Use lazy quantification in this way.

     /\[(.{1,255}?)\]/g