Skip to content

Strict comparison #3

@btholt

Description

@btholt

Hey! I've been using this for my project postcss-colorblind and I have a slight problem.

If you use the regex test on a URL that has an anchor link that is also a valid hex, the test method would return true.

Example:

var hex = require('hex-color-regex');
hex().test('url(http://www.example.com/index.html#f06d06)'); // returns true

The obvious fix for this is to use ^ and $. Would it make sense to take in a config object and have a strict parameter that adds ^ and $? If not, I'm content to fork this and use my own version. Otherwise, I'm also happy to work up a pull request if it useful.

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