Detect extra white space

Hi,

I’m trying to detect if the string contains “extra white spaces” more than one…

if YES than that string should be only detected not corrected.

ex: “Indian Institute of Technology.” This is correct.

But “Indian Institute of Technology.” This is incorrect.

Please help me with this…

Thanks in advance

U can use
IF Variable.contains(" ")

1 Like

Will this work for any number of spaces. i.e. more than one any number…?

This will be for 2 white space
u can use or condition for more whitespace

1 Like

@Abhishek_Changan use the following regex and assign into boolean variable
System.Text.RegularExpressions.Regex.IsMatch(variable1,“\s{2,}”)

Sequence1.xaml (4.7 KB)
Please mark it as solution if it helped

2 Likes

Will this work for any number of spaces. i.e. more than one any number…?

1 Like

@Abhishek_Changan yes

1 Like

@Abhishek_Changan

Check as below, It will detect any number of spaces and make to 1 space

\s\s+

Mark as solution if this helps

Thanks

2 Likes

Hey @Srini84,

Thanks for update…

But I don’t want it to replace just detect and give True message “Extra Space detected”…

You can use regex for this task to identify multiple spaces
“\s{2}”

1 Like

then use ISMatches activity instead of replace

Mark as solution if this helps

Thanks

3 Likes

Ok will check on that and inform you…

Cheers

Hi @Srini84,

Thanks for elaborately explaining this…

Cheers…

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.