Regex in PreviewTextInput: only decimals between 0.0 and 1.0
问题 I'd like to have a regex, which only allows digits between 0.0 and 1.0 in a textbox. BUT it should be in the method PreviewTextInput (C#, WPF project) So the normal regex doesn't work Regex regex = new Regex(@"^0|0.0|0\.[0-9]*|1\.0|1$"); I've found a regex, which allows all decimals in the PreviewTextInput method: Regex regex = new Regex("^[.][0-9]+$|^[0-1.]*[.,]{0,1}[0-9]*$"); How can a change this regex to only accept decimals between 0-1? Thanks. My method for decimals: private void tb