% sign not accepted #12

Closed
csakai opened this Issue Jun 16, 2015 · 3 comments

Projects

None yet

2 participants

@csakai
csakai commented Jun 16, 2015

I tried entering the following regex into the regexper web app:
%[a-zA-Z0-9]{2}

in order to look for special characters in URLs (ie: %20 for whitespace)
I got a message: Malformed expression in URL.
when breaking down the regex, I find that everything works except for %

Therefore, it would appear regexper can't handle %, escaped or not

@javallone
Owner

I suspect this may be due to your browser not encoding the regex into the URL correctly. I've tried the regex you provided in Chrome and it rendered successfully.

Could you please post the URL you end up at when you get that error along with your web browser details (at the very least which browser you're using). Also, could you try loading this URL (it is the URL I get from Chrome): http://regexper.com/#%5C%25%5Ba-zA-Z0-9%5D%7B2%7D and let me know if it renders or if you receive the same error

@csakai
csakai commented Jun 16, 2015

This was the url that was formed by putting this request through firefox 38.0:
http://regexper.com/#\%25[a-zA-Z0-9]{2}

I just noticed how wacky that looks. Weirdly, when I hover over your link, it looks the same as the URL I got. I try copy-pasting it to the location bar, and it resolves to the same URL again. Very strange behavior.

@javallone
Owner

Looks like this is due to a long-standing Firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=483304

I'm going to add a work-around to detect Firefox's odd behavior.

@javallone javallone added a commit that closed this issue Jun 17, 2015
@javallone Support for FF's buggy location.hash
FF decodes location.hash for you, so decoding is unnecessary and breaks
when the regex contains a "%"

Fixes #12
e1f5891
@javallone javallone closed this in e1f5891 Jun 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment