A
A
Arslanali2020-05-29 14:52:41
PHP
Arslanali, 2020-05-29 14:52:41

How to extract multiple values ​​from a string with a regular expression?

Good afternoon.

The line in the file (there are a lot of such lines):

May 28 19:45:15 pfsdesk openvpn[31192]: ivanov.uh/192.1.250.6:1004 MULTI_sva: pool returned IPv4=10.10.1.2, IPv6=(Not enabled)


Need to get: May 28 19:45:15 | ivanov.uh | 192.1.250.6:1004 | 10.10.1.2
and print.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dodo512, 2020-05-29
@Arsen2011

^(\S+ \S+ \S+) .+?: (\S+?)/(\S+).+? IPv4=([\d.]+)
https://regex101.com/r/Ti77HR/1

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question