I am new to Perl programming. Need your help in searching and extracting only commented lines from a file. Below is an example
{
This is line 1
/*This is line 2
This is line 3
This is line 4*/
This is line 5
}
I just want to search and extract only commented lines from above file.
You can use a regex like this:
Working demo
Code
As Borodin pointed in his comment, you can use dot with
s
flag (single line) instead of[\s\S]
, so you could change your regex to: