Clement Martino
Clement Martino

Reputation: 475

Match all numeric characters without letters before or after

I try this:

\d+(?![a-zA-Z]+[0-9])\d+

but for this string:

azeaze4 T4 45-azej565 5T 555T 44444

I want to find:

45 44444

Upvotes: 2

Views: 38

Answers (2)

Kasravnd
Kasravnd

Reputation: 107297

You can just use \d+ within a word boundary :

\b\d+\b

See demo https://regex101.com/r/kH4cV5/1

Upvotes: 3

d0nut
d0nut

Reputation: 2834

This will find the write characters for you

(?<![a-zA-Z0-9])\d+(?![a-zA-Z0-9])

Upvotes: 0

Related Questions