alphanumericBoundary
Pattern that matches the boundary between alphanumeric and other characters.
Category: Language Fundamentals > Data Types
Syntax
pat = alphanumericBoundary
Creates a zero-width pattern that matches where an alphanumeric character meets a non-alphanumeric one, or the start or end of the text.
Description
Like the regular expression \b, it marks where a word starts or ends without being part of the match. Placed on both sides of another pattern, it makes that pattern match only whole words. Combine patterns with +, as in alphanumericBoundary + "cat" + alphanumericBoundary.
Output arguments
pat- A
patternobject that consumes no characters.
Example
Whole words only
str = "foo_bar baz";
extract(str, alphanumericBoundary + lettersPattern + alphanumericBoundary)
Output
ans = 3×1 string array
"foo"
"bar"
"baz"
See also
alphanumericsPattern lettersPattern digitBoundary letterBoundary extract