-1

Hello I have this kind of lines in my text :

Test | (4079|5657|5914) 

And I would like by a regex to have this :

Test | (4079:5657:5914) 

I tried this

replace this : ([0-9](3)|[0-9](3)|[0-9](3)) by this : ([0-9](3):[0-9](3):[0-9](3))

but it does not work...

Thank you very much !

revo
  • 43,830
  • 14
  • 67
  • 109
Paul
  • 43
  • 2
  • 2
    Possible duplicate of [Learning Regular Expressions](https://stackoverflow.com/questions/4736/learning-regular-expressions) – Biffen Jan 11 '19 at 10:10
  • Note that to match 3 consecutive digits you need to use`[0-9]{3}`. Can there be more numbers inside parentheses? Can there be other numbers? Like `(23|234|42353|43234|3)`? – Wiktor Stribiżew Jan 11 '19 at 10:11

2 Answers2

0

You may try this find and replace:

Find:    \((\d+)\|(\d+)\|(\d+)\)
Replace: ($1:$2:$3)

This appears to be working in a demo.

Tim Biegeleisen
  • 387,723
  • 20
  • 200
  • 263
0

You can make use of Find and Replace with regex

  • Press Ctrl + H in Sublime Text
  • Select Regular expression
  • Enter the following

    Find: (\d+)\|

    Replace: $1:

  • Hit Replace All

enter image description here

Input:

Test | (4079|5657|5914)
Test | (4079|5657|5914|1224344|123) 

Output

Test | (4079:5657:5914)
Test | (4079:5657:5914:1224344:123) 
Deepak Mahakale
  • 19,422
  • 8
  • 58
  • 75