Invalid pattern in look-behind - Ruby

I am trying to validate some string as below

er34:12:roo, #vaild
er34:12: # invalid
er34:12:foo\n #vaild
foo\n #valid


invalid pattern in look-behind

Dear Arup,

Ruby and Perl doesn’t support non-deterministic (variable lenght)

"Many regex flavors, including those used by Perl and Python, only
allow fixed-length strings. You can use literal text, character
escapes, Unicode escapes other than \X, and character classes. You
cannot use quantifiers orbackreferences. You can use alternation, but
only if all alternatives have the same length.

PCRE is not fully Perl-compatible when it comes to lookbehind. While
Perl requires alternatives inside lookbehind to have the same length,
PCRE allows alternatives of variable length. Each alternative still
has to be fixed-length.PHP, Delphi, R, and Ruby also allow
alternatives of different lengths in lookbehind."

Source: Regex Tutorial - Lookahead and Lookbehind Zero-Length Assertions

Best regards,
Abinoam Jr.

… so… you shouldn’t use \w+ only \w

Abinoam Jr.