regular expression for matching substring with wildcard

조회 수: 35 (최근 30일)
Bo
Bo 2011년 11월 29일
편집: Walter Roberson 2015년 2월 28일
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

채택된 답변

Walter Roberson
Walter Roberson 2011년 11월 29일
편집: Walter Roberson 2015년 2월 28일

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by