Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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


In reply to Re: What is regular expression for the following thing? by Corion
in thread What is regular expression for the following thing? by sanjay nayak

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2024-04-20 04:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found