I have a string of characters like this '12hjb42&34ni3&(*&'
in MATLAB.
I want to separate the digits and letters and everything else through regex or some other easier way. How can I do this?
I have a string of characters like this '12hjb42&34ni3&(*&'
in MATLAB.
I want to separate the digits and letters and everything else through regex or some other easier way. How can I do this?
Instead of using regular expressions, I think it would be easier to use the function ISSTRPROP:
Which would give you these results:
If you really wanted to use REGEXP, this is how you could do it:
I don't think regex can handle this unless you know how many number/string/else chunks you have ahead of time. For example in 'st34*' there are 3 chunks, so this would work:
If you don't know the number of chunks, you can cast to int and bucket into your 3 categories, then see where the category changes to find your break point.
I haven't tested this, but something like this should work.