Home > OS >  Regular expression get numbers after a specific string (ignore newline operators)
Regular expression get numbers after a specific string (ignore newline operators)

Time:06-04

I am currently trying to extract reference numbers from a string using a regular expression. Unfortunately, all my attempts have failed so far and I hope someone can help me here how to get out the numbers which follow "Ref 1:" and "Ref 2:". Here is my current attempt: https://regex101.com/r/zHOYCg/1

String:

ERROR\tERROR\tERROR\t\n
Ref 1:\n
4376113053884\n
Ref 2:\n
8013\t\n

Can someone help my?

CodePudding user response:

Something like this? ?<= means 'preceded by'.

(?<=Ref \d:\\n\n)\d 
  • Related