Capture group doesn't work for .+ or *
See original GitHub issueQuick one since we’re all ready for the holidays! Happy to go into more detail when people are free.
Capture groups seem to capture everything BEFORE your target, if using .+
or *
. Using OR (#Noun|#Verb)+
works fine.
Quick console example:
> nlp('John always ravenously eats his glue').match('john [.+] eats').tag('test').debug()
=====
-----
| 'John' - MaleName, FirstName, Person, ProperNoun, Singular, Noun, TitleCase, Test
| 'always' - Adverb, Test
| 'ravenously' - Adverb, Test
| 'eats' - PresentTense, Verb, Test
> nlp('John always ravenously eats his glue').match('john [*] eats').tag('test').debug()
=====
-----
| 'John' - MaleName, FirstName, Person, ProperNoun, Singular, Noun, TitleCase, Test
| 'always' - Adverb, Test
| 'ravenously' - Adverb, Test
| 'eats' - PresentTense, Verb, Test
> nlp('John always ravenously eats his glue').match('john [#Adverb+] eats').tag('test').debug()
=====
-----
| 'always' - Adverb, Test
| 'ravenously' - Adverb, Test
> nlp('John always ravenously eats his glue').match('john [(#Noun|#Adverb)+] eats').tag('test').debug()
=====
-----
| 'always' - Adverb, Test
| 'ravenously' - Adverb, Test
Last two examples are correct and expected behaviour of the first 2.
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
Javascript regex capture groups not working - Stack Overflow
When using regexr it shows my expression to be working and capturing like it should, but when running it, it only captures from...
Read more >sed capture groups not working - Unix & Linux Stack Exchange
I have a string of the format [0-9]+\.[0-9]+\.[0-9] . I need to extract the first, second, and third numbers separately. As I understand...
Read more >Capturing groups - The Modern JavaScript Tutorial
When we search for all matches (flag g ), the match method does not return contents for groups. The result is an array...
Read more >non-capturing group not working? - Google Groups
A capturing group is a ( ) that is recorded in the indexed match list, what other languages might call $1, $2, $3...
Read more >Groupings and backreferences - JavaScript RegExp
First up, how to refer to capture group portions directly in regexp definition ... The 0 prefix trick doesn't work, but using ASCII...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hey @Drache93 I just discovered the
.export()
format bungles any sentence with a contraction. It’s kind of bad. I should have caught this before now.It’ll require a breaking change - the good news though, is that it’s an opportunity to change anything you’d like in this release - so free license to you. Take a crack at anything you want.
Will take another look at this next!