Search code examples
regexstringmatlabsplittokenize

Matlab split string multiple delimiters


I have a cell list of strings like this:

cellArr = 
      'folderName_fileName_no.jpg',
      'folderName2_fileName2_no2.jpg'

I want to get it like this

{folderName, fileName, no},
{folderName2, fileName2, no2}

How to do it in matlab? I know I can use

regexp(cellArr, '_', 'split'), 

but how can I use more than one delimiters?


Solution

  • I found it.. Thanks for the replies..

    regexp(cellArr, '[_.]', 'split')