System.Text.RegularExpressions.Regex.Replace(new_String.Substring(var_Start_Index, var_End_Index - var_Start_Index), @"[\s]{3,}", "|"

@“[\s]{3,}”, “|”
here i have error

Hi,

Which language do you use, VB or C#? if you use VB, can you try to remove remove “@”, as the following?

VB

System.Text.RegularExpressions.Regex.Replace(new_String.Substring(var_Start_Index, var_End_Index - var_Start_Index), "[\s]{3,}", "|")

C#

System.Text.RegularExpressions.Regex.Replace(new_String.Substring(var_Start_Index, var_End_Index - var_Start_Index), @"[\s]{3,}", "|")

if you have still error, can you share the error message.

Regards,

1 Like

still error
Error ERROR Validation Error Compiler error(s) encountered processing expression “System.Text.RegularExpressions.Regex.Replace(new_String.Substring(var_Start_Index, var_End_Index - var_Start_Index), “[\s]{3,}”, “|”)”.
Expression expected. Main.xaml

it is solved
thank you

1 Like

also i found this error i remove @ but still
Error ERROR Validation Error Compiler error(s) encountered processing expression “System.Text.RegularExpressions.Regex.Replace(new_String.Replace(”\n", ““), “\s{2,}”, “|”).Replace(””, “\n”).Split(‘\n’)".
Expression expected. Main.xaml

Hi,

Can you try the following expression?

String.Split method can have only char type or its array for argument.

If you want to split it by chr(10) : LF, the following works.

System.Text.RegularExpressions.Regex.Replace(new_String.Replace("\n", ""), "\s{2,}", "|").Replace("", "\n").Split(vbLf.ToCharArray)

If you want to split it by “\n”, the following will work.

Strings.Split(System.Text.RegularExpressions.Regex.Replace(new_String.Replace("\n", ""), "\s{2,}", "|").Replace("", "\n"),"\n")

Regards,

1 Like

it solved but until now i can not understand the error
when i use regex this error is append

Error ERROR Validation Error Compiler error(s) encountered processing expression “hader_Line + String.Join(”\n", arrey_String.Where(Line => System.Text.RegularExpressions.Regex.IsMatch(Line,“^\d{2,}”)))".
‘.’ expected. Main.xaml
also that sorry

Hi,

Your expression seems C#. Can you try to use VB expression as the following.

hader_Line + String.Join("\n", arrey_String.Where(Function(Line) System.Text.RegularExpressions.Regex.IsMatch(Line,"^\d{2,}")))

If you want to Join linebreak, the following might be better.

hader_Line + String.Join(vbLF, arrey_String.Where(Function(Line) System.Text.RegularExpressions.Regex.IsMatch(Line,"^\d{2,}")))

Or we can choose language (VB or C#) when create project. If you are familiar with C#, it might be better to re-create your project as C# mode.

Regards,

1 Like

ok and thank you

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