24小时热门版块排行榜    

查看: 420  |  回复: 0

100403140212

木虫 (正式写手)

超级水晶虫

[求助] matlab字符串的查找问题

各位大神问题如下(注:源自http://blog.csdn.net/mathsoperator/article/details/7232334
poestr = ['while I nodded, nearly napping, ' 'suddenly there came a tapping,'];
1)原作者regexp(poestr, '(?<nonwhitechar>\S)\k<nonwhitechar>', 'match')
运算结果ans =   'dd'    'pp'    'dd'    'pp'
2)我将程序稍作修改,poestr = ['while I nodded, nearly napping, ' 'suddenly there came a tapping,'];
regexp(poestr, '(?<nonwhitechar>\S).*\k<nonwhitechar>', 'match')
运算结果ans =   'hile I nodded, n...'    'ere came'    'a ta'    'pp'
请问为什么2)中运行结果,为第一个单词为啥不是while而是hile?
回复此楼
奔跑吧,骚年
已阅   回复此楼   关注TA 给TA发消息 送TA红花 TA的回帖
相关版块跳转 我要订阅楼主 100403140212 的主题更新
信息提示
请填处理意见