Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • 1
    Use [^)] instead . or if you already use -P (pcre regex) to prohibit regex be greedy you should add ? after *: grep -Po '(?<=\().*?(?=\))' Commented Feb 11, 2015 at 20:51
  • That worked. What about the lenght condition ? Where should I place it, and how ... in order to print words with only 3 characters ? Commented Feb 11, 2015 at 20:55
  • You have to study quantificator thoroughly. Three characters can be choised like ... (any 3 symbols) or, for example \w{3} (any 3 alphanumeric symbols) Commented Feb 11, 2015 at 21:05