Skip to content
Snippets Groups Projects
Commit 94504973 authored by Dominik Hebeler's avatar Dominik Hebeler
Browse files

Merge branch '320-suche-auf-dieser-domain-funktioniert-nicht-richtig' into 'development'

URL-Erkennung funktioniert besser

Closes #320

See merge request !510
parents a1d6d98e 1799b89a
No related branches found
No related tags found
2 merge requests!514Development,!510URL-Erkennung funktioniert besser
......@@ -287,18 +287,26 @@ class Result
/* Liest aus einer URL alle Informationen aus
* https://max:muster@www.example.site.page.com:8080/index/indexer/list.html?p1=A&p2=B#ressource
* (?:((?:http)|(?:https))(?::\/\/))? - https:// => [1] = http / https
* (?:(\w+):(\w+)@)? - username:password@ => [2] = username, [3] = password
* (?:(www)(?:\.))? - www. => [4] = www
* ((?:(?:\w+\.)+)?(\w+\.\w+)) - example.site.page.com => [5] = example.site.page.com, [6] = page.com
* (?:(?::)(\d+))? - :8080 => [7] = 8080
* ((?:(?:\/\w+)+)(?:\.\w+)?)? - /index/indexer/list.html => [8] = /index/indexer/list.html
* (\?\w+=\w+(?:&\w+=\w+)*)? - ?p1=A&p2=B => [9] = ?p1=A&p2=B
* (?:(?:#)(\w+))? - #ressource => [10] = ressource
* (?:((?:http)|(?:https))(?::\/\/))?
* https:// => [1] = http / https
* (?:([a-z0-9.\-_~]+):([a-z0-9.\-_~]+)@)?
* username:password@ => [2] = username, [3] = password
* (?:(www)(?:\.))?
* www. => [4] = www
* ((?:(?:[a-z0-9.\-_~]+\.)+)?([a-z0-9.\-_~]+\.[a-z0-9.\-_~]+))
* example.site.page.com => [5] = example.site.page.com, [6] = page.com
* (?:(?::)(\d+))?
* :8080 => [7] = 8080
* ((?:(?:\/[a-z0-9.\-_~]+)+)(?:\.[a-z0-9.\-_~]+)?)?
* /index/indexer/list.html => [8] = /index/indexer/list.html
* (\?[a-z0-9.\-_~]+=[a-z0-9.\-_~]+(?:&[a-z0-9.\-_~]+=[a-z0-9.\-_~]+)*)?
* ?p1=A&p2=B => [9] = ?p1=A&p2=B
* (?:(?:#)([a-z0-9.\-_~]+))?
* #ressource => [10] = ressource
*/
public function getUrlElements($url)
{
if (!preg_match("/(?:((?:http)|(?:https))(?::\/\/))?(?:(\w+):(\w+)@)?(?:(www)(?:\.))?((?:(?:\w+\.)+)?(\w+\.\w+))(?:(?::)(\d+))?((?:(?:\/\w+)+)(?:\.\w+)?)?(\?\w+=\w+(?:&\w+=\w+)*)?(?:(?:#)(\w+))?/", $url, $match)) {
if (!preg_match("/(?:((?:http)|(?:https))(?::\/\/))?(?:([a-z0-9.\-_~]+):([a-z0-9.\-_~]+)@)?(?:(www)(?:\.))?((?:(?:[a-z0-9.\-_~]+\.)+)?([a-z0-9.\-_~]+\.[a-z0-9.\-_~]+))(?:(?::)(\d+))?((?:(?:\/[a-z0-9.\-_~]+)+)(?:\.[a-z0-9.\-_~]+)?)?(\?[a-z0-9.\-_~]+=[a-z0-9.\-_~]+(?:&[a-z0-9.\-_~]+=[a-z0-9.\-_~]+)*)?(?:(?:#)([a-z0-9.\-_~]+))?/i", $url, $match)) {
return;
} else {
$re = [];
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment