Regular expression for 1*1 cell array
1 次查看(过去 30 天)
显示 更早的评论
Hello All,
I was trying to find the regular expression for a 1*1 cell array, the array looks somethig like this:
{'<string_attribute name="country"><s>CHINA5</s></string_attribute>'}
I need the country name string in above example, which is CHINA5, rest of the array would be same every time except the country string.
Any help is higley appreciated!
0 个评论
采纳的回答
更多回答(1 个)
Matt J
2019-11-12
编辑:Matt J
2019-11-12
c='<string_attribute name="country"><s>CHINA5</s></string_attribute>';
out=extractBetween(c,'<s>','</s>');
>> out{1}
ans =
'CHINA5'
2 个评论
Adam Danz
2019-11-12
This is definitley the better answer for r2016b and later.
I keep forgetting about that family of string functions introduced in that release.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Characters and Strings 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!