regexpcmp (strcmp meets regexp)

Checks whether strings match a regular expression (pattern) or not.
701 Descargas
Actualizado 23 jul 2010

Ver licencia

After a year of using cellfun to search for strings matching a regular expression, I developed this function. While it is easy to do in a single line of code, the line looks long and messy, so it is much cleaner and easier to read/understand when using this function. This is useful when you simply care whether the pattern exists in each string, not where it is nor what the actual found match is.

Syntax:
TF = regexpcmp(str,expr)
TF = regexpcmp(str,expr,'ignorecase')

str must be a string or cell array of strings
expr must be a valid regular expression
'ignorecase' option ignores the case of the regular expression

TF is a logical array which is true when a match is found, false otherwise

Citar como

Jason Kaeding (2024). regexpcmp (strcmp meets regexp) (https://www.mathworks.com/matlabcentral/fileexchange/28279-regexpcmp-strcmp-meets-regexp), MATLAB Central File Exchange. Recuperado .

Compatibilidad con la versión de MATLAB
Se creó con R2010a
Compatible con cualquier versión
Compatibilidad con las plataformas
Windows macOS Linux
Categorías
Más información sobre Characters and Strings en Help Center y MATLAB Answers.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versión Publicado Notas de la versión
1.0.0.0