Question:
There is a string of numbers separated by a semicolon:
2;1;1;1;1;1;5;1;1;1;1;0;1;1;1;1;1;1;1;1;1;0;1;3;17
Can't get the second number from the beginning, in this case it's 1
.
Tried various options, here is one of the latest:
(?=(^(\d;){1}))\d
Answer:
Instead of looking ahead, look back. For a line like
2;1;1;1;1;1;5;1;1;1;1;0;1;1;1;1;1;1;1;1;1;0;1;3;17
The following regex will suffice:
/(?<=;)\d+/
Test https://regex101.com/r/mRfIVr/1