Match Sequence using RegEx After a Specified Character

Use a look-behind:

(?<=:)[\w+.-]+

A look-behind (coded as (?<=someregex)) is a zero-width match, so it asserts, but does not capture, the match.

Also, your regex may be able to be simplified to this:

(?<=:)[^\]]+

which simply grabs anything between (but not including) a : and a ]

Leave a Comment