egor7
egor7

Reputation: 4941

select lines with "some" word

I've faces with the next one regular expression: "^.*\\(?:some\\).*$". I've understand ^ and $ and \\( with \\) for back-referencing.

But what is the ?:some construction?

Upvotes: 2

Views: 73

Answers (1)

stema
stema

Reputation: 92986

A group starting with ?: is a non capturing group, means there will be no backreference, the some would be your search word.

^ is an anchor to match the start of the line

$ is an anchor to match the end of the line

Your expression would match e.g.

Foobar some more text

Foobar somemore text

some

Upvotes: 3

Related Questions