regular expression for matching substring with wildcard

16 Ansichten (letzte 30 Tage)
Bo
Bo am 29 Nov. 2011
Bearbeitet: Walter Roberson am 28 Feb. 2015
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

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 29 Nov. 2011
Bearbeitet: Walter Roberson am 28 Feb. 2015

Weitere Antworten (0)

Kategorien

Mehr zu Characters and Strings finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by