Add whitespace and linebreaks to the regular expressions to make them clearer, and add a note explaining that the whitespace and linebreaks should be removed before use.

This commit is contained in:
Jonathan Silverblood
2018-09-29 19:27:49 +00:00
parent 03ab95c0ac
commit b9825a1646
+52 -6
View File
@@ -365,19 +365,65 @@ In order to reduce implementation costs and increase implementation conformity,
### Regular expressions ### Regular expressions
*The expressions listed here is shown with whitespace and linebreaks for clarity and ease of updating and should be removed before use.
To parse a **Challenge request** into its parts To parse a **Challenge request** into its parts
```javascript ```regexp
/(?P<scheme>cashid:)[\/]*(?P<domain>[^\/]+)(?P<path>\/[^\?]+)(?P<parameters>\?.+)?/ /
(?P<scheme>cashid:)
(?:[\/]{2})?
(?P<domain>[^\/]+)
(?P<path>\/[^\?]+)
(?P<parameters>\?.+)
/
``` ```
To parse the **Parameters** into their parts To parse the **Parameters** into their parts
```javascript ```regexp
/(?:[\?\&]a=)(?P<action>[^\&]+)?(?:[\?\&]d=)(?P<data>[^\&]+)?(?:[\?\&]r=)(?P<required>[^\&]+)?(?:[\?\&]o=)(?P<optional>[^\&]+)?(?:[\?\&]x=)(?P<nonce>[^\&]+)?/ /
(?:[\?\&]a=)(?P<action>[^\&]+)?
(?:[\?\&]d=)(?P<data>[^\&]+)?
(?:[\?\&]r=)(?P<required>[^\&]+)?
(?:[\?\&]o=)(?P<optional>[^\&]+)?
(?:[\?\&]x=)(?P<nonce>[^\&]+)?
/
``` ```
To parse the **Metadata** fields into their parts To parse the **Metadata** fields into their parts
```javascript ```regexp
/(i(?P<identification>(?![1-9]+))?(?P<name>1)?(?P<family>2)?(?P<nickname>3)?(?P<age>4)?(?P<gender>5)?(?P<birthdate>6)?(?P<picture>8)?(?P<national>9)?)?(p(?P<position>(?![1-9]+))?(?P<country>1)?(?P<state>2)?(?P<city>3)?(?P<streetname>4)?(?P<streetnumber>5)?(?P<residence>6)?(?P<coordinate>9)?)?(c(?P<contact>(?![1-9]+))?(?P<email>1)?(?P<instant>2)?(?P<social>3)?(?P<mobilephone>4)?(?P<homephone>5)?(?P<workphone>6)?(?P<postlabel>9)?)?/ /
(i
(?P<identification>(?![1-9]+))?
(?P<name>1)?
(?P<family>2)?
(?P<nickname>3)?
(?P<age>4)?
(?P<gender>5)?
(?P<birthdate>6)?
(?P<picture>8)?
(?P<national>9)?
)?
(p
(?P<position>(?![1-9]+))?
(?P<country>1)?
(?P<state>2)?
(?P<city>3)?
(?P<streetname>4)?
(?P<streetnumber>5)?
(?P<residence>6)?
(?P<coordinate>9)?
)?
(c
(?P<contact>(?![1-9]+))?
(?P<email>1)?
(?P<instant>2)?
(?P<social>3)?
(?P<mobilephone>4)?
(?P<homephone>5)?
(?P<workphone>6)?
(?P<postlabel>9)?
)?
/
``` ```