I tried to capture the second match from given text i.e,
hash=e1467eb30743fb0a180ed141a26c58f7&token=a62ef9cf-2b4e-4a99-9335-267b6224b991:IO:OPCA:117804471:OPI:false:en:opsdr:117804471&providerId=paytm
In the above text, I want to capture the second number with the length of 9 (117804471).
I tried following, but it didn't work; so please help me resolving in this.
You can use
See the regex demo.
Details:
^- start of string(?:- start of a non-capturing group:.*?- any zero or more chars other than line break chars (as few as possible) followed with\K- match reset operator discarding text matched so far\b[0-9]{9}\b- a 9-digit number as a whole word){2}- two occurrences of the pattern sequence defined above.