0
RangersIslandersDevils
KingDucks
Sharks
Blackhawks
Red Wings

How do I extract the following using regex?

Rangers
Islanders
Devils
Kings
Ducks
Sharks
Blackhawks
Red Wings

Basically those with spacing remains the same.

Patterns that I have tried that don't work:

[A-Z][a-z]+[^\s]
[A-Z][a-z]+[^\s]$
[A-Z][a-z]+[\s][A-Z][a-z]+|[A-Z][a-z]+

THANKS ALL I GOT IT!

Colour
  • 1
  • 1

1 Answers1

0

I think this pattern will match the Red Wings [A-Z][a-z]+( [A-Z][a-z]+)?

bn_ln
  • 1,648
  • 1
  • 6
  • 13
  • hi thanks for the help! but i got this instead [('Rangers', ''), ('Islanders', ''), ('Devils', ''), ('King', ''), ('Ducks', ''), ('Sharks', ''), ('Blackhawks', ''), ('Red Wings', ' Wings')] – Colour Sep 14 '22 at 09:03
  • Then you're done right? Just build the list from the first match object and ignore the second one. – bn_ln Sep 14 '22 at 09:22