全站数据
8 4 2 0 5 8 1

matlab regpress函数是什么

IT小猫 | 简单学习,快乐成才!         
问题更新日期:2024-11-16 00:56:35

问题描述

matlab regpress函数是什么,在线求解答
精选答案
最佳答案

regexp匹配正则表达式。[startIndex,endIndex]= regexp(str,expression),其中str是输入的字符串expression是正则表达式,返回值为子串的开始和结束下标。

如果expression是普通的字符串,就变成了查找子串的下标;如果expression是正则表达式,就查找满足正则表达式的子串的下标。 举例: >> [startIndex,endIndex]= regexp('hello world','or') startIndex = 8 endIndex = 9 >> [startIndex,endIndex]= regexp('hello world',' ') startIndex = 6 endIndex = 6 >> str = 'bat cat can car coat court CUT ct CAT-scan'; expression = 'c[aeiou]+t'; startIndex = regexp(str,expression) startIndex = 5 17