in reply to What is regular expression for the following thing?

You have an error with precedence in your regular expression. The alternation (|) doesn't know where you want it to stop. See YAPE::Regex::Explain if you want a module that explains regular expressions to you.

Your regular expression currently matches like

(?-imsx:^REGISTER|INVITE|BYE\s\w\.\w\sSIP/2.0) matches as follows: NODE EXPLANATION ---------------------------------------------------------------------- ^ the beginning of the string ---------------------------------------------------------------------- REGISTER 'REGISTER' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- INVITE 'INVITE' ---------------------------------------------------------------------- | OR ---------------------------------------------------------------------- BYE 'BYE' ---------------------------------------------------------------------- \s whitespace (\n, \r, \t, \f, and " ") ---------------------------------------------------------------------- \w word characters (a-z, A-Z, 0-9, _) ---------------------------------------------------------------------- \. '.' ---------------------------------------------------------------------- \w word characters (a-z, A-Z, 0-9, _) ---------------------------------------------------------------------- \s whitespace (\n, \r, \t, \f, and " ") ---------------------------------------------------------------------- SIP/2 'SIP/2' ---------------------------------------------------------------------- . any character except \n ---------------------------------------------------------------------- 0 '0' ----------------------------------------------------------------------

Maybe you want the Net::SIP module instead of writing your own module?

As an aside, putting your code between <code>...</code> tags makes the code render and download nicely for those who want to try it.

Update: YAPE::Regex::Explain installed and I updated the explanation