ranjeet
ranjeet

Reputation: 540

Match regex : Extract Number only between space

I have string text as

17-2018-04-04 17:31:00,289 20055001        [email protected]

How can i extract number 20055001.

I am using this \s\d+(?=\s++) , but i am getting space between number.

Upvotes: 0

Views: 53

Answers (1)

Yassin Hajaj
Yassin Hajaj

Reputation: 21995

In the same way you used a positive-lookahead for the spaces after the number, you should use a positive-lookbehind for the spaces before

(?<=\s)\d+(?=\s++)

Demo

Upvotes: 2

Related Questions