Regex get numbers next line

I have the below numbers in a txt file:

1234567890
9999.16
55555;
55555;
55555;
2345678901

Question 1:
I use “(?<=\r|\n)(\d+)(?=\r|\n)” to capture the longer 10-digit numbers
but the first one is not captured so I change it to ^(\d+)(?=\r|\n). Then the second one is not captured. Any idea?

Question 2:
And also the 9999.16 and it is always with the decimal… so… with the (.) in the middle

Question 3:
Also, I try the similar concept for the 55555; string using:
“(?<=\r|\n)(.*)(?=;)(?=\r|\n)”
“(?<=\r|\n)(?=;)(?=\r|\n)”
but nothing is captured - also I want only the numbers but not ;
Any idea?

Thanks!!

Lavina

Hi @lavint,

Question 1:

Pattern: (\d){10}

Question 2:

Pattern: (\d+)(\.)(\d+)

Question 3:

Pattern: (\d+)(\;)

Regards, Arivu :slight_smile:

2 Likes

Got it! Thanks a lot :smiley: