TF = matches(str,pat)
returns 1 (true) if the specified pattern matches
str, and returns 0 (false)
otherwise. If str is an array, then TF is an array of
the same size.
If pat is an array containing multiple patterns, then
matches returns 1 if it finds that any element of
pat matches str.
Find the strings that match "Earth". Return a logical array where the position of each element equal to 1 corresponds to the position of a matching string in str.
TF = matches(str,"Earth")
TF = 1×4 logical array
0 0 1 0
Display the match by indexing back into str using TF.
Create a pattern that matches the hexadecimal numbers. To match a single hexadecimal digit, specify a pattern that matches any digit, any capital letter A-F, or any lowercase letter a-f. Then, specify a pattern that begins with 0x and is followed by any number of hexadecimal digits.
pat = digitsPattern(1) | characterListPattern("A","F") | characterListPattern("a","f");
pat = "0x" + asManyOfPattern(pat)
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window.
Web browsers do not support MATLAB commands.
Sélectionner un site web
Choisissez un site web pour accéder au contenu traduit dans votre langue (lorsqu'il est disponible) et voir les événements et les offres locales. D’après votre position, nous vous recommandons de sélectionner la région suivante : .
Vous pouvez également sélectionner un site web dans la liste suivante :
Comment optimiser les performances du site
Pour optimiser les performances du site, sélectionnez la région Chine (en chinois ou en anglais). Les sites de MathWorks pour les autres pays ne sont pas optimisés pour les visites provenant de votre région.