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 -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -