Regular expression for 1*1 cell array
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
raghavendra kandukuri
le 12 Nov 2019
Commenté : Adam Danz
le 12 Nov 2019
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 commentaires
Réponse acceptée
Plus de réponses (1)
Matt J
le 12 Nov 2019
Modifié(e) : Matt J
le 12 Nov 2019
c='<string_attribute name="country"><s>CHINA5</s></string_attribute>';
out=extractBetween(c,'<s>','</s>');
>> out{1}
ans =
'CHINA5'
2 commentaires
Adam Danz
le 12 Nov 2019
This is definitley the better answer for r2016b and later.
I keep forgetting about that family of string functions introduced in that release.
Voir également
Catégories
En savoir plus sur Characters and Strings dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!