user3664020 user3664020 - 3 years ago 315
Python Question

extract first three numbers from a string

I have strings like


I want to extract following from above


I tried using indices of numbers but cant use them since they are variable. Only thing constant here is the length of the characters appearing in the beginning of each string.

Answer Source

Another way would be this regex:


import re
m ='_(\\d+.*?)_', 'ABCD_ABCD_6.2.15_3.2')
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download