Replace only the first occurrence in a string

Replace only the first occurrence in a string

Eg: 0/767 0/djffk
replace 0/ as null and
Need output as
767 0/djffk

@Sweety_Girl
control can be done by setting the number or replacements. have a look here on the count parameter:

Else you could play with the Options like multiline or with the line starter ^

I would suggest option 1:
grafik

RegExReplace_FirstOccurence_Only.xaml (4.9 KB)

2 Likes

@Sweety_Girl Try the following :

DemoString = “0/767 0/djffk”
DemoString = DemoString.Substring(2)Solution

Thank You…

2 Likes

Hi @Sweety_Girl

  1. Below is the SS for Regex :-
    image

  2. Assign to a variable like below :-
    Regex.Replace(“0/767 0/djffk”,"^0/","")
    image

  3. Output :-
    image

So you can mark this as a solution now and like it. :innocent:

Happy Automation :raised_hands:

Best Regards
Er Pratik Wavhal :robot::man_technologist:t4: :computer:

1 Like

@ppr, @Pratik_Wavhal, @Pratik_Wavhal

All solution Works!!..

Thank you

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