Skip to content
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

Issue with characters that require excapes #143

Open
the-moog opened this issue Dec 16, 2024 · 1 comment
Open

Issue with characters that require excapes #143

the-moog opened this issue Dec 16, 2024 · 1 comment

Comments

@the-moog
Copy link

The following regex seems to need escapes for the "/" on most platforms.

If entered on the site https://regex-vis.com the escape backslash is deleted from "/" as soon as you press enter.
Oddly it does not do that with the escaped backslash "\" in the same regex.

^:?((('\/?(\\'|[^'])+')|("\/?(\\"|[^"])+")|(\/?([^'"])+)+):?)*$ 

is changed to

^:?((('/?(\\'|[^'])+')|("/?(\\"|[^"])+")|(/?([^'"])+)+):?)*$

Also, though perhaps this is just a limitation, if I enter more than three tests I just get a blank screen.
Example tests:

/usr/local/sbin:'/usr/lo\'cal/bin':/usr/sbin:/usr/bin:/sbin:/bin:/root/.local/bin

I am guessing once you have a few like this it's breaking the size of the request URL or using characters that are not URL encoded properly.

@Bowen7
Copy link
Owner

Bowen7 commented Dec 18, 2024

Hi, thanks for your report.

I entered the regex that you mentioned, and the escape backslash wasn't deleted as soon as I entered it.

I know there's a situation where the escape backslash will be deleted from /: If you edit the regex using the Edit tab, the regex will be regenerated by the new AST. However, I don't store the escape info in the AST, so the unnecessary escape backslash is deleted. If you wrap the regex with //, like /^:?((('\/?(\\'|[^'])+')|("\/?(\\"|[^"])+")|(\/?([^'"])+)+):?)*$/, the escape for / is considered necessary, and thus the escape backslash won't be deleted. I plan to store the escape info in the future.

About the blank screen, I can not reproduce it. Is the regex ^:?((('\/?(\\'|[^'])+')|("\/?(\\"|[^"])+")|(\/?([^'"])+)+):?)*$?

I generated a url. If you click it, you will see the regex with five tests. It looks good on my side.

Can you provide your OS, browser info, the regex and the full tests? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants