Increase content found by regex and increment with other strings

1

I need more help with regex, how do I find a text in a particular pattern and include something next to the string that it found. EX:

"programacao": "11h Abertura – Som Mecânico 12h30 Lino e Orquestra 15h30 Volkstanzgruppe Blauer Berg - Timbó - SC (Infanto Juvenil) 15h45.

Every time you find the% pattern for%, for example, it replaces with the same content and includes xxhxx(12h30) thus getting <br>

    
asked by anonymous 27.09.2017 / 20:29

1 answer

2

Answer
Use this regex to capture:

(\d{2}h\d{0,2})

In the replacement part use:

<br>

You can see the operation of this regex here.

Explanation

  • \d - identifies a number (0-9), equivalent to [0-9]
  • {2} - imposes that it is necessary to find 2 digits in a row to give match .
  • h - match with character h
  • \d - identifies a number (0-9), equivalent to [0-9]
  • {0,2} - imposes that the previous pattern must be found between 0 and 2 times, after all the time can be represented as 12h = 12h00 .
  • <br> - In the replacement part you can use this pattern to insert <br> and what was captured in group 1 through the \
27.09.2017 / 20:40