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.

8
  • Why doesn't apt find PCRE2 as pcre2grep on Ubuntu 19.04? $ sudo apt-get install pcre2grep; Reading package lists... Done; Building dependency tree; Reading state information... Done; E: Unable to locate package pcre2grep
    – vstepaniuk
    Commented Jan 1, 2020 at 11:55
  • @vstepaniuk: As I said above, "You'll find pcre2grep in Debian/Ubuntu package pcre2-utils."
    – rici
    Commented Jan 1, 2020 at 13:45
  • Why doesn't apt find PCRE2 as pcre2grep on Ubuntu 19.04?
    – vstepaniuk
    Commented Jan 1, 2020 at 14:18
  • 1
    @vstepaniuk: because whoever built the package which contains various utilities using libpcre2 chose not to build a separate package only containing pcre2grep. I have no idea what went into that decision. You would have to ask them. But apt only knows about package names.
    – rici
    Commented Jan 1, 2020 at 14:33
  • "You can use the -oN command more than once if you want to output more than one capture group.". Which pcregrep supports this? I have pcregrep version 8.21 2011-12-12. When specifying multiple groups, only the last one gets returned. echo 'Name:"John" Email:"[email protected]"' | pcregrep -o1 '(?=Name:"(\w+?)".*Email:"(\w+@\w+\.\w+)")' John echo 'Name:"John" Email:"[email protected]"' | pcregrep -o2 '(?=Name:"(\w+?)".*Email:"(\w+@\w+\.\w+)")' [email protected] echo 'Name:"John" Email:"[email protected]"' | pcregrep -o1 -o2 '(?=Name:"(\w+?)".*Email:"(\w+@\w+\.\w+)")' [email protected]
    – Zongjun
    Commented Dec 26, 2022 at 22:25