Field validation question

How to ensure a field contains a certain character at all times as validation. can this be done using regular expression ?  an example will be helpful. basically this input field should not contain spaces , but should contain dot (.)
1 answers

Yes can be done easily with regular expression
For example, 


The above regex checks for any number of characters A-Z or a-z or a dot. Only combination of these characters will form a valid string. Spaces if added will make string invalid. You can further control amount of characters like one dots, 0 or more, at least one etc. 

one dot only [.]{1}
two dot only [.]{2}
zero or more [.]*
one or more  [.]+

In current regex, empty string is a valid string. You can modify * with + to have string with at least one character. 

Please follow some regex tutorial to understand the options available:

There are online editors available to test regex with strings. You can try those and when you create a regex matching your requirements you can use that.