I am trying to construct a regular expression with the following requirements

1. Pattern should start with letters `a-z`
2. Can have any character from character class `[\w:-]`.
3. Can have any number of underscores `_` but only if there is a `:` somewhere before it in the pattern.

**Some examples of valid patters**

hello123

hello:123

hello-hello

hello:123-hello\_345 # Valid pattern as there is a `:` in the pattern before `_`

hello-1:hell\_world\_123

**Invalid patterns**

hello\_123

hello-123\_world

hello\_123:world

I have tried using the lookaheads but for some reason it does not work, below is the pattern i came up with

`^[a-z]+[a-z0-9:-]*(?<=:)[_]*\w*` - the issue with this pattern is that it stops matching the entire pattern if there is no `:` anywhere in the string, so it kind of makes the `:` a required pattern.

I only want to check the existence of `:` if there is `_` anywhere in the string before `:`.