regex - Matching specific lengths with regexp in Matlab -


string matching question in matlab. if have matrix

a = ['thehe']; str = {'the','he'}; match = regexp(a,str); 

the output match =

[1]    [1x2 double] 

because found 'he' twice , 'the' once how can make looks left right of string , matches 'the' once , 'he' once?

to answer explicit question, the documentation regexp can specify once search option:

a = 'thehe'; str = {'the','he'}; match = regexp(a,str, 'once'); 

which returns:

match =       [1]    [2] 

where match 1x2 cell array cell value(s) correspond first index of match in a each cell of str.


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

excel - I can't get the attachement of the email PHP -

node.js - Express and Redis - If session exists for this user, don't allow access -