How can I use regex to get the part of a string between two specific characters ":" and "@"?

regex

Solution

this should do the job

(?<=^sip:)(.*)(?=[$@])

Problem

How I can get part of SIP URI? For example I have URI `sip:username@sip.somedomain.com`, I need get just `username` and I use `[^sip:](.*)[$@]+` expression, but appeared result is `username@`. How I can exclude from matching `@`?

Original source

Related problems