0

I'm trying to learn regular expressions. I want to write a regular exprssion that matches an unknown number of words like Martin Arguello (ARG) I think I can write it like this /\w+\s\w+\s(\w+)/ but I also want to make it work for Martin Vassallo Arguello (ARG) without duplicating that code (so i can extend it easy)? I have tried to solve it with this /(\w+\s+){2,}(\w+)/, but it didn't help.

Thanks in advance and kind regards, lerak

lerak
  • 1
  • 1

1 Answers1

0

I think this RegExp is what you looking for:

(\w+\s)+\(\w+\)
Michał Z.
  • 1,322
  • 1
  • 10
  • 17
  • 1
    yes, that one works, I think the one I had also might be oke. I just found a mistake in a file that I was using. I think that was causing all the trouble. Thanks a lot! – lerak Apr 04 '18 at 17:39