I am working on a middleware tool in which we have an predefined option of using java regular expressions with subStringRegEx( regex , string).
My requirement is to get the required substring between the underscores(_) from given filename( ex: ABC_XYZ_123_adbc1234-ed98_1234.dat).
I have tried below 3 ways and all are working when tested with online tools by selecting java. Whereas not working as expected in my tool, I am getting “ABC_XYZ_123_ adbc1234-ed98” instead of only “adbc1234-ed98” value.
(?:[^_]+)_(?:[^_]+)_(?:[^_]+)_([^_]+).*?_.*?_.*?_([^_]+)^[^_]*_[^_]*_[^_]*_([^_]*)_
Request your suggestions to achieve the solution.
Thanks, Kumar