Splitting the string using regular expression or string split

조회 수: 10 (최근 30일)
'a_bb_ccc_ddd_eeeeee_ffff_gg_h_i'
I have a string like this.
I need to split the string as
a_bb_ccc
ddd_eeeeeee
ffff_gg_h_i
how to use the regular expression or stringsplit in order to get the above output?
  댓글 수: 3
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015년 5월 5일
i need to split after third underscore and then after fifth underscore

댓글을 달려면 로그인하십시오.

채택된 답변

Jan
Jan 2015년 5월 5일
s = 'a_bb_ccc_ddd_eeeeee_ffff_gg_h_i'
index = strfind(s, '_');
parts = {s(1:index(3)-1), s(index(3)+1:index(5)-1), s(index(5)+1:end)}
  댓글 수: 1
Gopalakrishnan venkatesan
Gopalakrishnan venkatesan 2015년 5월 5일
편집: Gopalakrishnan venkatesan 2015년 5월 5일
Thats great. Thanks a lot. is it possible to do with regular expression

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by