How to remove space and junk character from middle of Date

Hello Friends,
Can anyone help me to remove space and extra characters from below mentioned format of data using regex.
INPUT

26-05-1994 to
1-05- 201 9
31.05.1 0
31.05.19 0
31/03/2019 0
23/03/2019 -
30/04/2019 0
25-05- 2019

OUTPUT

26-05-1994
1-05-2019
31.05.1
31.05.19
31/03/2019
23/03/2019
30/04/2019
25-05-2019

Thank you

Hi Buddy @harsh.mehta
–lets take you have these values in datatable named out_dt
–use a for each row loop and pass the above variable as input
–inside the loop use a if condition to check whether it has space or not
like this
row(“yourcolumnname”).ToString.Trim.Contains(" ")
and if this condition gets passed it will go to THEN part where we can use assign activity
like this

row(“yourcolumnname”)= “26-05-1994 to”
then
use a assign activity like this in the THEN part of if condition
row(“yourcolumnname”)= Split(row(“yourcolumnname”)," ")(0).ToString.Trim
where the output would be “26-05-1994”

or if the above condition fails it will go to ELSE part where we can leave it empty as we dont need to change anything as there is no space to trim

Hope this would help you
Kindly try this and let know for any queries or clarification
Cheers @harsh.mehta

Thank you so much. Suggestion for something like 31.05.20 19, 31-05- 2019

Hello @harsh.mehta
For 31.05.20 19
You can use row.(yourcolumnname). tostring.replace(" “,”")
Thanks

1 Like

Thanks

Hi @harsh.mehta,

Regex pattern to get the data

\d+.(.| )\d+.(.| )\d+

After get the regex pattern value replace the empty value to null.

Regards,
Arivu

1 Like