regular expression for matching substring with wildcard

34 vues (au cours des 30 derniers jours)
Bo
Bo le 29 Nov 2011
Hi,
I would like to find the number of substrings in a string. The substring contains a unimportant character. For example:
string a = 'AFAFABBB' substring: 'AXA' (X represent an unimportant character)
If I use:
regexp(a,'A.A')
in matlab, it returns:
ans = 1
But the correct answer (for my case) should be 1 and 3. How to make that right?
Thanks!
Bo

Réponse acceptée

Walter Roberson
Walter Roberson le 29 Nov 2011
Modifié(e) : Walter Roberson le 28 Fév 2015

Plus de réponses (0)

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!

Translated by