Hank K
Hank K

Reputation: 151

Find UPPERCASE names that end with a colon

Find UPPERCASE names that start with either a letter or digits. Could include digits, hyphens, periods and spaces with colon at end of name.

MR. SMITH:
- CAPTAIN AMERICA:
ANT-MAN:
2014 NEBULA:
-2012 IRON MAN:
BOY 1:

1
00:00:07,174 --> 00:00:09,837
BARTON: Okay, hold on.

16
00:00:36,411 --> 00:00:37,527
- COOPER: Nice!
- LAURA: Nice throw, kiddo.

Here is my best attempt, but it is also selecting parts of the timecodes. It's also not filling groups correctly.

Find: ([A-Z0-9])(?:([A-Z0-9\.\-\s]*)*\:+)

regex101

Thanks in Advance !

Upvotes: 0

Views: 38

Answers (1)

Alireza
Alireza

Reputation: 2123

Try this pattern: ([A-Z0-9][A-Z0-9. -]+)(?=:\B)

See Regex101 Demo

Upvotes: 1

Related Questions