spamscanner / url-regex-safe

Regular expression matching for URL's. Maintained, safe, and browser-friendly version of url-regex. Resolves CVE-2020-7661 for Node.js servers.
https://forwardemail.net/docs/url-regex-javascript-node-js
MIT License
79 stars 16 forks source link

fix: don't match a trailing period after the path #29

Closed birtles closed 11 months ago

birtles commented 11 months ago

Fixes #17.

This also extends trailingPeriod: false (the default) to exclude matching a trailing question mark (?) or exclamation mark (!).

That is if you want "Check out example.com/project." to NOT match the trailing period, you typically also want it to NOT match the trailing exclamation mark in "Check out example.com/project!". Likewise for "Have you seen example.com/project?".

I guess technically trailingPeriod should be renamed trailingPunctuation but maybe it's fine as-is?

Checklist

titanism commented 11 months ago

Amazing work! 🙏 Thank you!

titanism commented 11 months ago

Publishing now, one moment

titanism commented 11 months ago

v4.0.0 released with this, thank you @birtles

release notes @ https://github.com/spamscanner/url-regex-safe/releases/tag/v4.0.0

note: this version now requires node v14+