S
S
Shellr57s2020-10-09 21:02:50
Regular Expressions
Shellr57s, 2020-10-09 21:02:50

How to cut everything in a string except certain values?

Hello. There are such lines:
d32d32d slot1=342 xqw dd3 d3 slot2=125 d32djk3 mdmkdm32od 3 slot3=13 yuguy m jhj
You need to get the following result:
slot1=342 slot2=125 slot3=13
- values ​​slot1-3= fixed static.
- value after = numeric ending value space. In slot3= there can be -1 except for purely numeric values, the ending is also a space.

Thanks in advance for your replies.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-10-09
@Shellr57s

Find: .*?($|\w+=-?\d+)
Replace: $1
The replacement string has a space after $1.
https://regex101.com/r/hgdaSR/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question