For example i have numbers text
8.40083897*
S903040058061*
51097653
1.51097653P
0051384034*51384034* 40083897* 40078422**
I need get from this
40083897*
40058061*
51097653
51097653
51384034*
40078422**
So i use regex
/([0-9*]{8,10})/
It work good except it takes and count numbers from left, how say to regex count from right?
So if exist * then start counting from asteriks and length only 9
So if exist ** then start counting from last asteriks and length only 10
So if not exist * then start counting from last digit and length only 8