Original post

Hey Guys,

At the moment I build an Webapp to manage a WireGuard VPN Server.

So something like this is going to get matched with regex:

peer: ****= endpoint: *** allowed ips: 0.0.0.0/0, ::/0 transfer: 0 B received, 148 B sent persistent keepalive: every 21 seconds peer: ***= endpoint: *** allowed ips: 10.200.200.8/32, fd00::10:97:8/128 latest handshake: 4 seconds ago transfer: 11.75 MiB received, 2.72 MiB sent peer: ***= endpoint: *** allowed ips: 10.200.200.2/32, fd00::10:97:2/128 latest handshake: 1 minute, 26 seconds ago transfer: 289.87 MiB received, 1.91 GiB sent 

And what I want to find is this line:

 289.87 MiB received, 1.91 GiB sent 

to output that into the Webapp.

So I came up with a regex that does that:

(?<=transfer: ).+ – but that one won’t work in .

I tried to modify it:

(?:transfer: ).+ – but this matches:

transfer: 289.87 MiB received, 1.91 GiB sent 

What does the regex need to be, to get rid of the transfer?

Thank you for your help !

submitted by /u/cevinxf
[link] [comments]