How to remove empty spaces for given text?

input text variable is given below

@"

   ALLARDICE
   GEOFFREYMR
 


 
    408 
   DXB
   MEL 
   HK
   
 
 
   SUR 
   HK
   <![CDATA[/CDA/EK0408/14OCTDXBMEL/DXB.CROWN METROPOLE HOTEL 8 WHITEMAN ST SOUTHBANK VIC 3006 AUSTRALIA 971506002704]]>
 


 
   
     CTCM
     
     
       
         ALLARDICE
         GEOFFREYMR
       
     
     
     HK
   
   
     CTCE
     
     
       
         ALLARDICE
         GEOFFREYMR
       
     
     <![CDATA[GEOFF.ALLARDICE//ICC./CRICKET.COM]]>
     HK
   
   
     CTCM
     
     
       
         ALLARDICE
         GEOFFREYMR
       
     
     
     HK

"

Hi!

Try this:

strText=System.Text.RegularExpressions.RegEx.Replace(strInputVariable,"\s+","").ToString

Reference:

Regards,
NaNi

Hi @Soundarya_Guduri

You can try with this expression

System.Text.RegularExpressions.Regex.Replace(YourString,"\s"," ")

Regards
Gokul

Check out this XAML file @Soundarya_Guduri

RemoveSpaceString.xaml (5.4 KB)

image

Regards
Gokul

Thankyou for your response @Gokul001 , @THIRU_NANI
But the problem is here
my input text is of type XElement , I have converted to string inorder to display in Action form.
Actually i need to display the content in XElement which is shown in below regex link.
Could you suggest an alternative .

Input file.txt (2.2 KB)