I need a regex who find the number in bold below :
20 (L.B.D.D. hello 312312) Potato 1651 (98)
20 (L.B.D.D. hello 312312 bu
This only matches 312312 in the first capture group:
^.*?\([^\d]*(\d+)[^\d]*\).*$
Regexplanation:
^ # Match the start of the line
.*? # Non-greedy match anything
\( # Upto the first opening bracket (escaped)
[^\d]* # Match anything not a digit (zero or more)
(\d+) # Match a digit string (one or more)
[^\d]* # Match anything not a digit (zero or more)
\) # Match closing bracket
.* # Match the rest of the line
$ # Match the end of the line
See it here.