Quick reg. expression help
OK so I have a string that looks like this (mime):
Code:
text/plain; charset=UTF-8
And I want to get rid of anything after the ";" so that I end up with just
Here is my code so far:
Code:
mimeType = mimeType.replaceAll(";*", "");
However that code only gets rid of the ";" and nothing else giving me:
Code:
text/plain charset=UTF-8
What am I doing wrong? I have this other codes that does work but I still want to know why my reg. expression is not working:
Code:
temp = mimeType.split(";");
mimeType= temp[0];
This code above is prob faster than a reg. ex? But I still need to learn reg. expressions! Thanks!