Reputation: 499
I want use regex to match a pattern (exp: double slash), that is not at the starting of a line. From the example below, I would like to match the double slash of line 5 and line 7 only. I am new to regex, hope to get some help from pro here :) Thanks in advance
// This is line 1
// This is line 2
// This is line 3
Something // This is line 5
Something // This is line 7
// This is line 8
Upvotes: 0
Views: 50
Reputation: 785156
You can use this regex with negative lookahead:
(?!^)\/{2}
(?!^)
is negative lookahead that means don't match //
at line start.
Upvotes: 1