Solved

Replace first / (A) and second / (B)

  • 10 March 2021
  • 2 replies
  • 2 views

Badge +5

Hi all,

I want to replace in this:

12/3 >> 12 A 3

13/2/5 >> 13 B 2 A 5

Could you show me how to make regex? Thank you

icon

Best answer by david_r 10 March 2021, 08:57

View original

2 replies

Userlevel 5

The easiest is probably to use two separate StringReplacers, one for each case.

 

One slash:

Search for: ^(\d+)/(\d+)$
Replace with: \1 A \2

Two slashes:

Search for: ^(\d+)/(\d+)/(\d+)$
Replace with: \1 B \2 A \3

 

 

 

Badge +5

The easiest is probably to use two separate StringReplacers, one for each case.

 

One slash:

Search for: ^(\d+)/(\d+)$
Replace with: \1 A \2

Two slashes:

Search for: ^(\d+)/(\d+)/(\d+)$
Replace with: \1 B \2 A \3

 

 

 

Thank you so much

Reply