온라인 URL 정규표현식 검사기
웹 링크, 도메인 이름, 쿼리 스트링, 프로토콜 스키마를 실시간으로 테스트하세요. API 입력값 유효성 검사에 최적화되어 있습니다.
URL Regex Validation FAQ
What is the best regex pattern for validating URLs?
A standard, dependable URL regex for web applications is: /^(https?:\/\/)?((([a-z0-9]([a-z0-9-]*[a-z0-9])?\.)+[a-z]{2,})|localhost)(:\d+)?(\/[-a-z0-9%_.~+]*)*(\?[;&a-z0-9%_.~+=-]*)?(\#[-a-z0-9_]*)?$/i. It checks protocol, domain/subdomain, optional port, path, query parameters, and hash anchors.
Should a URL regex require http:// or https://?
It depends on user intent. In forms where users might type 'google.com' without the scheme, allow the protocol to be optional using (https?:\/\/)?. In security-sensitive redirects (OAuth callbacks), always strictly require https:\/\/.
How do I validate URLs in JavaScript without complex regex?
Modern browsers and Node.js support the new URL(string) constructor. However, combining a regex validator with the URL API is recommended because new URL('http://foo') parses successfully even for non-routable domains.