Removing some character

Hi,

123/456/789/R1
124/789/789

in this some cases have /R1 some cases dont have that element now i need one regex condition if its found /R0 or /R1 or /R2 whatever revision it may be u can remove it and keep only without revision value its remove /R to ehat ever number next to that from /R itself ignore those characters

Thanks in advance

Hi
–use this expression in a assign activity
str_output = IF(str_input.Contains(“R”),Split(str_input,"/R")(0).ToString,str_input)

where str_input = “123/456/789/R1” and str_output is a variable of type string
Cheers @Shriharsha_H_N

2 Likes


it is the error

2 Likes

just now i modified the expression buddy
str_output = IF(str_input.Contains(“R”),Split(str_input,"/R")(0).ToString,str_input)

Cheers @Shriharsha_H_N

2 Likes

Hi,

You can get it using Replace activity the following settings.

Pattern “/R¥d+$”
Replacement “”

Regards,

1 Like

hi @Shriharsha_H_N

first match string with following RegEx

regEX : . “[0-9/]+/R.”

if it matched then you remove the /R char from it.
if not matched then do nothing

Regards
Ajay

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