I have a requirement to extract the number of characters before and after REGEX match.
For example:
Input : ABCDEFGHIJK//MNOPQRST
Output : IJK//MNOPQ
Input : zzzABCDEFGHIJK//MNOPQRST
Output :
I want only first 3 characters before "//" and 5 characters after "//". Also exclude line that starts with zzz.
The code currently I am using to search // :
^(?!.*zzz)?=.{0,3}//.{0,100}[a-zA-Z0-9])(?=\S+$).{2,5000} --- Not working
(?=.{0,3}//.{0,100}[a-zA-Z0-9])(?=\S+$).{2,5000} --- Working
https://regex101.com/r/ry6Y09/1 --- Regex demo
I need to specify limit.