문제

So far I've got the following regex that matches against regular domains but not domains with underscores. Example: _tcp._sip.45.example.com. Any help would be greatly appreciated.

(?P<name>([a-zA-Z0-9]([a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,6})
도움이 되었습니까?

해결책

\b((xn--)?[a-z0-9\w]+(-[a-z0-9]+)*\.)+[a-z]{2,}\b 

try this one, or stick with yours, basicaly \w is what you add for underscore.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top