O'Reilly logo

Reguläre Ausdrücke Kochbuch by Steven Levithan, Jan Goyvaerts

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

7.7 Generische URLs validieren

Problem

Sie wollen prüfen, ob ein Stück Text eine nach dem RFC 3986 gültige URL ist.

Lösung

\A (# Schema [a-z][a-z0-9+\-.]*: (# Authority & Pfad // ([a-z0-9\-._~%!$&'()*+,;=]+@)? # Benutzer ([a-z0-9\-._~%]+ # Named Host |\[[a-f0-9:.]+\] # IPv6 Host |\[v[a-f0-9][a-z0-9\-._~%!$&'()*+,;=:]+\]) # IPvFuture Host (:[0-9]+)? # Port (/[a-z0-9\-._~%!$&'()*+,;=:@]+)*/? # Pfad |# Pfad ohne Authority (/?[a-z0-9\-._~%!$&'()*+,;=:@]+(/[a-z0-9\-._~%!$&'()*+,;=:@]+)*/?)? ) |# Relative URL (kein Schema und keine Authority) (# Relativer Pfad [a-z0-9\-._~%!$&'()*+,;=@]+(/[a-z0-9\-._~%!$&'()*+,;=:@]+)*/? |# Absoluter Pfad (/[a-z0-9\-._~%!$&'()*+,;=:@]+)+/? ) ) # Query (\?[a-z0-9\-._~%!$&'()*+,;=:@/?]*)? # Fragment (\#[a-z0-9\-._~%!$&'()*+,;=:@/?]*)? ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required