I'm trying to figure out the correct way of using Regex to filter a String so that it's in this format exactly:
I've looked online through some documentation and I can't seem to get it working correctly. This is what I have so far and have tested:
I'm not sure why it does not work from what I read. However, I don't know much about Regex's and am probably making this more difficult than it is. Any help is appreciated, thank you.
EDIT: I have the String one working, however I now need to allow the String to have whitespace in it:
e.g.string 1: string 1
EDIT 2: After realizing the user will probably have an unassertive amount of spaces, I have come to the conclusion that this works best:^.*[:].*$