BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

regex.php 1.6KB

123456789101112131415161718192021222324252627
  1. <?php
  2. // resource_type://username:password@domain:port/path?query_string#anchor
  3. define('RESOURCE_REGEX', '(https?|ftps?):\/\/');
  4. define('IP_REGEX', '(\d{1,3}\.){3}\d{1,3}');
  5. define('DOMAIN_REGEX', '([a-z0-9\-\_]+\.)*[a-z0-9\-\_]+');
  6. define('PORT_REGEX', ':\d{1,5}');
  7. define('URL_REGEX', '('.RESOURCE_REGEX.')('.IP_REGEX.'|'.DOMAIN_REGEX.')('.PORT_REGEX.')?(\/\S*)*');
  8. define('USERNAME_REGEX', '/^[a-z0-9_]{2,20}$/iD');
  9. define('EMAIL_REGEX', '[_a-z0-9-]+([.+][_a-z0-9-]+)*@'.DOMAIN_REGEX);
  10. define('IMAGE_REGEX', URL_REGEX.'\/\S+\.(jpg|jpeg|tif|tiff|png|gif|bmp)(\?\S*)?');
  11. define('VIDEO_REGEX', URL_REGEX.'\/\S+\.(webm)(\?\S*)?');
  12. define('CSS_REGEX', URL_REGEX.'\/\S+\.css(\?\S*)?');
  13. define('SITELINK_REGEX', RESOURCE_REGEX.'(www.)?'.preg_quote(SITE_DOMAIN, '/'));
  14. define('TORRENT_REGEX', SITELINK_REGEX.'\/torrents\.php\?(.*&)?torrentid=(\d+)'); // torrentid = group 4
  15. define('TORRENT_GROUP_REGEX', SITELINK_REGEX.'\/torrents\.php\?(.*&)?id=(\d+)'); // id = group 4
  16. define('ARTIST_REGEX', SITELINK_REGEX.'\/artist\.php\?(.*&)?id=(\d+)'); // id = group 4
  17. # https://www.crossref.org/blog/dois-and-matching-regular-expressions/
  18. define('DOI_REGEX', '10.\d{4,9}\/[-._;()\/:A-Z0-9]+');
  19. # https://www.biostars.org/p/13753/
  20. define('ENTREZ_REGEX', '\d*');
  21. # https://www.wikidata.org/wiki/Property:P496
  22. define('ORCID_REGEX', '0000-000(1-[5-9]|2-[0-9]|3-[0-4])\d{3}-\d{3}[\dX]');
  23. # https://www.biostars.org/p/13753/
  24. define('REFSEQ_REGEX', '\w{2}_\d{1,}\.\d{1,}');
  25. # https://www.uniprot.org/help/accession_numbers
  26. define('UNIPROT_REGEX', '[OPQ][0-9][A-Z0-9]{3}[0-9]|[A-NR-Z][0-9]([A-Z][A-Z0-9]{2}[0-9]){1,2}');