caseSensitivePattern

Pattern that distinguishes upper and lower case when matching.

Category: Language Fundamentals > Data Types

Syntax

newPat = caseSensitivePattern(pat)

Makes pat match only with the exact case.

Description

This is the default behaviour of patterns, so the function matters when it is used inside a search that was told to ignore case, for example with 'IgnoreCase', true. The wrapped part still requires the exact letters while the rest of the pattern ignores case.

Input arguments

pat
A pattern or text.

Output arguments

newPat
A pattern object.

Example

Exact case required

contains('ABC', caseSensitivePattern('b'))
contains('ABC', caseSensitivePattern('B'))
Output
ans = logical
   0
ans = logical
   1

See also

caseInsensitivePattern contains extract pattern