in reply to Extracting substrings from scalars
Strangely, I don't see a CPAN module for SIP (wow).
The general answer to your specific enquiry (given elsewhere) is of course to use regular expressions.
In your specific case, a quick look at the RFC suggests that a SIP From: line can contain an 'name-addr' which seems to be an optional display-name and then an 'addr-spec', which is a SIPS URI or other kind of URI. This will be in angle brackets if a display name is present. (Just like RFC822 email addresses).
Getting this sort of thing right is hard (witness all the web apps which have their own ideas of what constitutes a valid email address, or the 6k-regexp to match an RFC822 address in 'Mastering Regular Expressions' - but I digress).
Happily - checking back on CPAN shows that the URI module supports sip: and sips: url schemes, so you basically want to:
One last idea is that you might be able to simply (hah) cut-and-paste the ABNF grammar from the RFC into a parser-generator (Parse::RecDescent?) and use that, but you may run into differences of how to specify a grammar.
Good luck :-)
|
|---|