It doesn’t matter what comes before and after the regex. As long as the char sequence lettuce wrap
occurs exactly like this anywhere in the message, it will count as a match. What doesn’t count is something like lettuce or tomato wrap
.
The resulting array will have a 1
for any token (i.e. word) that contains a part of the matched regex. So in your examples, for “get me lettuce wraps ASAP” it will be [0 0 1 1 0]
and for “Im hungry, I need a …**.**lettuce wrap.” it will be [0 0 0 0 0 1 1]
.