New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protocol regex wrong? #132

Closed
hackerwins opened this Issue Jan 13, 2014 · 5 comments

Comments

Projects
None yet
3 participants
@hackerwins

There is a problem with the regular expression to determine the protocol.

URI.protocol_expression = /^[a-z][a-z0-9-+-]*$/i;

https://github.com/medialize/URI.js/blob/gh-pages/src/URI.js#L172

How about changing -+- to -+\. ?

http://stackoverflow.com/questions/3641722/valid-characters-for-uri-schemes

@rodneyrehm

This comment has been minimized.

Show comment
Hide comment
@rodneyrehm

rodneyrehm Jan 13, 2014

Member

Not sure how that slipped by the tests. Good call. Do you want to send a PR?

Member

rodneyrehm commented Jan 13, 2014

Not sure how that slipped by the tests. Good call. Do you want to send a PR?

@hackerwins

This comment has been minimized.

Show comment
Hide comment
@hackerwins

hackerwins Jan 13, 2014

@rodneyrehm Thanks to reply. Yeap. 👍

@rodneyrehm Thanks to reply. Yeap. 👍

@ooxi

This comment has been minimized.

Show comment
Hide comment
@ooxi

ooxi Jan 14, 2014

Shouln't -+\. be -+. since it is already in a character class?

P.S.: Not sure about the following but I head that - should be the last character in a character class since it has a special meaning for character ranges like a-z. So I would suggest using .+- instead of -+-

ooxi commented Jan 14, 2014

Shouln't -+\. be -+. since it is already in a character class?

P.S.: Not sure about the following but I head that - should be the last character in a character class since it has a special meaning for character ranges like a-z. So I would suggest using .+- instead of -+-

@rodneyrehm

This comment has been minimized.

Show comment
Hide comment
@rodneyrehm

rodneyrehm Jan 14, 2014

Member

It can, but it's not mandatory. I've made a habit of escaping things in character classes as well. and yes, if - is not escaped, it must come last.

Member

rodneyrehm commented Jan 14, 2014

It can, but it's not mandatory. I've made a habit of escaping things in character classes as well. and yes, if - is not escaped, it must come last.

@rodneyrehm

This comment has been minimized.

Show comment
Hide comment
@rodneyrehm

rodneyrehm Jan 23, 2014

Member

The issue is resolved in v1.12.0

Member

rodneyrehm commented Jan 23, 2014

The issue is resolved in v1.12.0

@rodneyrehm rodneyrehm closed this Jan 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment