The file looks like
[N the computer end] [M whatever] [N you look] [N why not]
I only need the words in the bracket that start with [N
so here I want to get the computer end you look why not
they may or may not in the same line
I tried something like this:
if($line =~/\[N(.+?)\]/)
but it only match the first one of each line.
Use the
gmodifier on the regular expression to look for “g”lobal matches. Either like this:Or like this: