multiformats / multiaddr

Composable and future-proof network addresses
https://multiformats.io/multiaddr
MIT License
419 stars 84 forks source link

Improve the regular expression #134

Open ben221199 opened 1 year ago

ben221199 commented 1 year ago

This pull request updates the regular expression of multiaddr.

marten-seemann commented 1 year ago

I don't think this was intended as a regexp.

ben221199 commented 1 year ago

I don't know, but I do know that not every multiaddr segment holds a value, so the second part should be optional if you interpret it as RegEx.

ben221199 commented 1 year ago

The expression you wrote down is incorrect, if interpreted as a regexp. It doesn't even match the example given in the line below.

Okay, it is isn't fully RegEx, but because of the () as "group" and the + as "one or more", I thought the ? as "optional" would make sense too.