Hello, I'm wanting to know if there is a way to limit the number of spaces that can be used in text input boxes. I am creating a quiz that requires people to enter an answer into a text input and check if it is correct or not. I linked the input to a text label with TrimEnds to remove any spaces at the beginning and end of the input but I want to prevent multiple spaces to happen between words.
In this scenario, the correct answer is Hepatitis B, this can be marked correct with/without capital letters or spaces at the beginning or end - however if someone puts a double space between the two words then it will mark it as incorrect. Is there a way around this, where I can substitute multiple spaces to single spaces only? I don't want people being marked as incorrect if they have entered the right answer with basic human error of click spacebar more than once
My check answers formula is as follows:
If(
IsMatch(
Label1.Text,
"Hepatitis B",
MatchOptions.Complete & IgnoreCase
),
UpdateContext({visibleCorrect: true});
UpdateContext({visibleIncorrect: false})
);
If(
Not(
IsMatch(
Label1.Text,
"Hepatitis B",
MatchOptions.Complete & IgnoreCase
)),
UpdateContext({visibleCorrect: false});
UpdateContext({visibleIncorrect: true})
)
Here are examples of how the formula is currently operating:

