How to write a regular expression to cut out the extra text?

Hello!

I have a log that looks like this:
27527 php /var/www/html/worker/Worker.php 3256 1581264072
27726 php /var/www/html/src/Controller/../../worker/Worker.php 3847


There are two type of lines:
27726 php /var/www/html/src/Controller/../../worker/Worker.php 3847
and
27527 php /var/www/html/worker/Worker.php 3256 1581264072

I need to cut all types of lines 4 digit ID (in bold) and delete the rest:
27726 php /var/www/html/src/Controller/../../worker/Worker.php 3847
and
27527 php /var/www/html/worker/Worker.php 3256 1581264072

In order to obtain the log of the form:
3847
3256
...


How can I write regular expression for this task?
April 7th 20 at 10:51
1 answer
April 7th 20 at 10:53
Solution

Find more questions by tags Regular expressions