Capture a percentage that varies between two and three digits per line

Hey, guys

I need a regex help again.

How to capture the value in square brackets plus the percentage?

in the example below I need to capture only the value “150%” or just “150”.

however there can be 3 decimal places, or it can be with two decimal places, for example “50%” or “50”

the name “ABCDETAL” will always be different, so the code must be per line

By default, below the line:

Cuntratop (Take %) Montante (MWh)

Would anyone know?

Cliynte Inforbações Montante (MWh)
DYSNEAY POPOJ Consumo                           1.438,082
Perdas (3,0%)                                43,142
Período de Suprimento PROINFA                                27,348
ago/21 Necessidade                           1.453,876

Cuntratop (Take %) Montante (MWh)
ABCDETAL (150%)                           1.445,964
TESTE                                   7,912
Toawe Cuntratop                           1.453,876

@Guilherme_Silva - Could you please check this…

  (?<=Montante \(MWh\)\r?\n?.+\().+(?=\))

Hope this helps…

Regex101 Link

Note: you can use \d+% instead of .+ as shown here

1 Like

muito bom!!

obrigado!!

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