Question: I have a data grouped data, 

```
df <- data.frame(group_id= c(1, 1, 1, 1, 2, 1, 2, 3, 4),
                words = c("beach", "sand", "trip", "warm","travel", "water","beach","sand", "trees"),
                 ID = c("vacation", "vacation", "vacation", "vacation", "meeting","vacation","meeting","onduty", "hiking"))

```

The `group_id` is groups of `ID` column. Now I want to check certain patterns ("beach" or "warm" or "sand") for each group, and print the matching pattern in separate column and matches 0 (no match) or 1 (yes macth) in separate column.

Expected :

```
  id  words       ID           pattern Match
1  1  beach vacation Beach, sand, warm 1
2  1   sand vacation Beach, sand, warm 1
3  1   trip vacation Beach, sand, warm 1
4  1   warm vacation Beach, sand, warm 1
5  2 travel  meeting Beach             1
6  1  water vacation Beach, sand, warm 1
7  2  beach  meeting Beach             1
8  3   sand   onduty sand              1
9  4  trees  hiking  0                 0

```

Answer: 
**Scanner.skip skips a input which matches the pattern, here the pattern is :-**

(\r\n|[\n\r\u2028\u2029\u0085])?
================================

* ? matches exactly zero or one of the previous character.
* | Alternative
* [] Matches single character present in
* \r matches a carriage return
* \n newline
* \u2028 matches the character with index 2018 base 16(8232 base 10 or 20050 base 8) case sensitive
* \u2029 matches the character with index 2029 base 16(8233 base 10 or 20051 base 8) case sensitive
* \u0085 matches the character with index 85 base 16(133 base 10 or 205 base 8) case sensitive

> 
> 1st Alternative \r\n
> 
> 
> 

* \r matches a carriage return (ASCII 13)
* \n matches a line-feed (newline) character (ASCII 10)

> 
> 2nd Alternative [\n\r\u2028\u2029\u0085]
> 
> 
> 

* Match a single character present in the list below [\n\r\u2028\u2029\u0085]
* \n matches a line-feed (newline) character (ASCII 10)
* \r matches a carriage return (ASCII 13)
* \u2028 matches the character with index 202816 (823210 or 200508) literally (case sensitive) LINE SEPARATOR
* \u2029 matches the character with index 202916 (823310 or 200518) literally (case sensitive) PARAGRAPH SEPARATOR
* \u0085 matches the character with index 8516 (13310 or 2058) literally (case sensitive) NEXT LINE
This ignores one [line break, see `\R`](https://docs.oracle.com/javase/9/docs/api/java/util/regex/Pattern.html).

Exactly the same could have been done with `\R` - sigh.

```
scanner.skip("\\R?");

```