0

For this string

Some AB, Author C., Names DEF. The title string. T journal name 2018;10:560-564

I would like to get just the authors. So I tried to split for . (dot and space).

But using the regex /^(.*)(?:\.\s).*/ doesn't match for my expected Some AB, Author C., Names DEF, instead I do get also the title as my first match.

I don't understand why. Maybe someone can explain what I'm doing wrong.

https://regex101.com/r/HLBmbf/1

user3142695
  • 15,844
  • 47
  • 176
  • 332

1 Answers1

0

This will capture what you're looking for.

^(.*)(?:\.\s.*\.\s).*

Basically you were not capturing the last \.\s only, when you needed to not capture the last 2 instances of that.

emsimpson92
  • 1,779
  • 1
  • 9
  • 24