Home > other >  How can i search for numbers in a particular line
How can i search for numbers in a particular line

Time:06-24

I need help finding the numbers for a specific line.

This is the entire text:

Circular No. 00-00-0000-000-C
Guayaquil, June XX, 20xx
Subject: FISCAL INSTRUCTION No. 12345678910
Mister
General Manager
For your knowledge and pertinent purposes, please attach hereto, in
...

I have this:

(Subject.*\n)

Finds the line that says Subject but I am missing the numbers.

Expected result (with only numbers):

12345678910

Thank you very much in advance for your help.

CodePudding user response:

In case you are using ECMAScript flavor Here is your answer

(?<=Subject.*)\d 

Demo: https://regex101.com/r/hSY6VW/1

I have also test with vscode and it worked

CodePudding user response:

Assuming you can make use of a capture group, I would phrase your regex as:

^Subject: .* No\. (\d )

Here is a working demo.

  • Related