Find rows that contain three digit number

r, regex

Solution

The `^` and `$` signs refer to the beginning and end of the string, respectively. You shouldn't be matching anything before or after them.

If you want rows that contain that pattern, you shouldn't use the anchors at all. You should just use this: `<[0-9]{3}>` (or shorten it to `<\\d{3}>`)

Problem

I need to subset rows that contain `<three digit number>` I wrote ``` foo <- grepl("<^[0-9]{3}$>", log1[,2]) others <- log1[!foo,] ``` but I'm not really sure how to use regex...just been using cheat sheets and Google. I think the < and > characters are throwing it off.

Original source