unjs / magic-regexp

A compiled-away, type-safe, readable RegExp alternative

Home Page:https://regexp.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not.word is not defined

darsh-agrawal71 opened this issue Β· comments

πŸ› The bug

In the docs it is written not can be prefixed before word, wordChar, wordBoundary, digit, whitespace, letter, letter.lowercase, letter.uppercase, tab, linefeed or carriageReturn.

But when i used it in my javascript project it returns undefined

Steps to reproduce:

  1. create new index.js
  2. run npm init -y
  3. install magic-regexp package
    4:
    import {not} from 'magic-regexp'

//const regexp = createRegExp(not.word.times); <- error

console.log(Object.keys(not).includes('word')) //false
console.log(Object.keys(not).includes('wordChar')) //true

πŸ› οΈ To reproduce

https://stackblitz.com/edit/github-cr7ofh?file=index.mjs

🌈 Expected behaviour

Expected that not.word would not be undefined as it was in the docs

ℹ️ Additional context

No response

Hi @darsh-agrawal71,

Thanks for reporting this issue, I believe this was an oversight while I was updating the docs, but after some thoughts, we should be able to add not.word as RegExp \b\W+\b, will make a PR soon πŸ‘