question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Capture group doesn't work for .+ or *

See original GitHub issue

Quick 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:closed
  • Created 4 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
spencermountaincommented, Jan 17, 2020

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.

1reaction
Drache93commented, Jan 17, 2020

Will take another look at this next!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found