Browse Source

Add more biology regexes

pjc 5 years ago
parent
commit
2447f44c76
1 changed files with 14 additions and 4 deletions
  1. 14
    4
      classes/regex.php

+ 14
- 4
classes/regex.php View File

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

Loading…
Cancel
Save