There are no headers and parameters in your example, so I donโt know how they appear. But you can use the following code to match the lines of the example:
[EDIT1 - added regular expression to match hostname strings and user support: password based on new OPs URI examples]
[EDIT2 - added regular expression params and headers and commented on the "OR" part of the regular expression]
import re uriList = [ 'sip:192.1.2.3', 'sip: 123@192.1.2.3 ', 'sip:192.1.2.3:5060', 'sip: 123@ [2620:0:2ef0:7070:250:60ff:fe03:32b7]', 'sip:[2620:0:2ef0:7070:250:60ff:fe03:32b7]', 'sip:[2620:0:2ef0:7070:250:60ff:fe03:32b7]:5060', 'sips: support@voip.example.com ', 'sip: 22444032@voip.example.com :6000', 'sip:support: pass@212.123.1.213 ', 'sip:support: pass@212.123.1.213 ;urlparams=test', 'sip:support: pass@212.123.1.213 ?auth=basic', 'sip:support: pass@212.123.1.213 ;urlparams=test?auth=basic', ] mPattern = re.compile( '(?P<scheme>\w+):'
The result I get:
Scheme: sip, User: , Password: , Host: 192.1.2.3, Port: , Params: , Headers: Scheme: sip, User: 123, Password: , Host: 192.1.2.3, Port: , Params: , Headers: Scheme: sip, User: , Password: , Host: 192.1.2.3, Port: 5060, Params: , Headers: Scheme: sip, User: 123, Password: , Host: 2620:0:2ef0:7070:250:60ff:fe03:32b7, Port: , Params: , Headers: Scheme: sip, User: , Password: , Host: 2620:0:2ef0:7070:250:60ff:fe03:32b7, Port: , Params: , Headers: Scheme: sip, User: , Password: , Host: 2620:0:2ef0:7070:250:60ff:fe03:32b7, Port: 5060, Params: , Headers: Scheme: sips, User: support, Password: , Host: voip.example.com, Port: , Params: , Headers: Scheme: sip, User: 22444032, Password: , Host: voip.example.com, Port: 6000, Params: , Headers: Scheme: sip, User: support, Password: pass, Host: 212.123.1.213, Port: , Params: , Headers: Scheme: sip, User: support, Password: pass, Host: 212.123.1.213, Port: , Params: urlparams=test, Headers: Scheme: sip, User: support, Password: pass, Host: 212.123.1.213, Port: , Params: , Headers: auth=basic Scheme: sip, User: support, Password: pass, Host: 212.123.1.213, Port: , Params: urlparams=test, Headers: auth=basic
Try it and see if it works for you.