user1022738
user1022738

Reputation: 63

regular expressions - match only if entire line is contained in match

Let's say I have the following text:

abcdabcd
abcdabcdabcd
abcdabcdabcdabcd
etc...

I only want a match if the entire line is only made out of even number of 'abcd' occurrences. meaning the first and third line should match and the second should not.

Upvotes: 2

Views: 82

Answers (1)

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 726579

^(abcdabcd)+$ expression should work.

Upvotes: 5

Related Questions