Extract Variables from mixed string
4 views (last 30 days)
Walter Roberson on 12 Aug 2018
S = '# Message: onset_pic1_8.png';
parts = regexp(S, '(?<name1>[A-Za-z]+)_(?<name2>[A-Za-z]+)(?<num1>\d+)_(?<num2>\d+)', 'names')
struct with fields:
I coded to permit uppercase as well as lowercase, but I did assume that the alphabetic parts remain alphabetic and the numeric parts remain numeric.