Skip to content

Special characters trailing issue #767

@jcubic

Description

@jcubic

It seems that the PR to fix the slash as a trailing character of the URL didn't fix the issue:

I have a URL that ends with parenthesis:

https://en.wikipedia.org/wiki/Tree-sitter_(parser_generator)

And the closing parenthesis is not recognized as part of the URL.

The fix is to add all special characters or refactor the whole RegEx.

Potential fix using existing solution:

\b(?:[\/()[\].,;:!?']+)?

Also note that in hash you can put anything. I use a JSON array to keep the state in one of my websites.

https://terminal.jcubic.pl/404#[[0,1,"jargon%20magic"]]

Maybe it's worth using AI to create a full regex. Or use a library that is proven to work. It's also worth adding some tests to verify that the regex works correctly.

As for hash, I would just accept every non-space. Another option is to expose the regex to the user in the option (with the current default value) so the user can change it.

I can help create a PR if you're ok if it will be written by AI (of course, tested).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions