You've already forked cashId
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:
@@ -365,19 +365,65 @@ In order to reduce implementation costs and increase implementation conformity,
|
||||
|
||||
### 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
|
||||
```javascript
|
||||
/(?P<scheme>cashid:)[\/]*(?P<domain>[^\/]+)(?P<path>\/[^\?]+)(?P<parameters>\?.+)?/
|
||||
```regexp
|
||||
/
|
||||
(?P<scheme>cashid:)
|
||||
(?:[\/]{2})?
|
||||
(?P<domain>[^\/]+)
|
||||
(?P<path>\/[^\?]+)
|
||||
(?P<parameters>\?.+)
|
||||
/
|
||||
```
|
||||
|
||||
To parse the **Parameters** into their parts
|
||||
```javascript
|
||||
/(?:[\?\&]a=)(?P<action>[^\&]+)?(?:[\?\&]d=)(?P<data>[^\&]+)?(?:[\?\&]r=)(?P<required>[^\&]+)?(?:[\?\&]o=)(?P<optional>[^\&]+)?(?:[\?\&]x=)(?P<nonce>[^\&]+)?/
|
||||
```regexp
|
||||
/
|
||||
(?:[\?\&]a=)(?P<action>[^\&]+)?
|
||||
(?:[\?\&]d=)(?P<data>[^\&]+)?
|
||||
(?:[\?\&]r=)(?P<required>[^\&]+)?
|
||||
(?:[\?\&]o=)(?P<optional>[^\&]+)?
|
||||
(?:[\?\&]x=)(?P<nonce>[^\&]+)?
|
||||
/
|
||||
```
|
||||
|
||||
To parse the **Metadata** fields into their parts
|
||||
```javascript
|
||||
/(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)?)?/
|
||||
```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)?
|
||||
)?
|
||||
/
|
||||
```
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user