Score:0

Regex does not work with grep

pk flag

Why does this match

.*\/.+\/wp-admin.*404
[03/Sep/2021:18:58:29 +0200] "GET /up/wp-admin/install.php HTTP/1.1" 404 6197

regexr.com

But in grep it does not?

sudo grep -rh ".*\/.+\/wp-admin.*404" /var/log/apache2/ | wc -l
0

I know the line exists in that folder. If I replace + by * it works.

Score:0
ao flag

With GNU grep, you have to backslash-escape the '+' character. Can you please try this grep -rh ".*\/.\+\/wp-admin.*404" /var/log/apache2/ | wc -l

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.