Matching characters in Java regex

I would like to extract some numbers that a star doesn't follow, here is an example:

1
0
0*1543
27 123*5464
11 1007*
998*7586
13
997*686

I tried using this regex and a few more, but none of them worked:

(\d+)[^\*]

What I'm looking for is to get all the numbers if there is no star left behind them. Here is the result:

1
0
27
11
13

My plan was to write a regular expression and use groups to extract these values. I use this site to check my regular expression.

Update: I am not looking for matching numbers after *, that is, I want only the numbers at the beginning of the line. thank

Update II:

Subsequent recoding to matches specified by regular expression (from Dr.Kameleon)

(?<!\*)(?<![0-9])([0-9]+(?!\*)(?![0-9])) 

I get an extra match as this can be seen here:

http://regexr.com?30l69

505 222*123 505. .

, , , .. (?<!\*)(?<![0-9])(?<!\\s)([0-9]+(?!\*)(?![0-9]))

+3
1

: (demo: http://regexr.com?30l47)

([0-9]+(?!\*)(?![0-9]))

this ( , ) - http://regexr.com?30l4a :

(?<!\*)(?<![0-9])([0-9]+(?!\*)(?![0-9]))
+5

All Articles