grepRaw searches for substring pattern matches within a raw vector x.
grepRaw(pattern, x, offset = 1L, ignore.case = FALSE,
value = FALSE, fixed = FALSE, all = FALSE, invert = FALSE)
| Parameter | Description |
|---|---|
pattern |
raw vector containing a regular expression (or fixed pattern for fixed = TRUE) to be matched in the given raw vector. Coerced by charToRaw to a character string if possible. |
x |
a raw vector where matches are sought, or an object which can be coerced by charToRaw to a raw vector. Long vectors are not supported. |
ignore.case |
if FALSE, the pattern matching is case sensitive and if TRUE, case is ignored during matching. |
offset |
An integer specifying the offset from which the search should start. Must be positive. The beginning of line is defined to be at that offset so "^" will match there. |
value |
logical. Determines the return value: see ‘Value’. |
fixed |
logical. If TRUE, pattern is a pattern to be matched as is. |
all |
logical. If TRUE all matches are returned, otherwise just the first one. |
invert |
logical. If TRUE return indices or values for elements that do not match. Ignored (with a warning) unless value = TRUE. |
# NOT RUN {
grepRaw("no match", "textText") # integer(0): no match
grepRaw("adf", "adadfadfdfadadf") # 3 - the first match
grepRaw("adf", "adadfadfdfadadf", all=TRUE, fixed=TRUE)
## [1] 3 6 13 -- three matches
# }