@karthi2809 please try the following
| rex "refId=Id-(?<refID>[^\\\]+)"
Following is a sample run anywhere search to test the same in Splunk
| makeresults | eval _raw="refId=Id-214f1652024d824e1f4cef63be666139\x00" | rex "refId=Id-(?<refID>[^\\\]+)"
This is the best answer from an efficiency point of view - 13 Steps (but watch how many
\\ you use)
The other examples, whilst working both involve > 75 steps.
Ha, that's cheating, you changed It! 😄
But yes, that's fewer steps, although the step count is only reduced because there are fewer characters to process.
The trade-off is that since you are being less specific with the preceding character match, the chances of a false positive are higher. Not an issue given the very limited example in the post, but matching preceding strings does not add any real penalty, and gives you the confidence of reducing FPs.
Join the regex channel on Splunk Slack if you fancy getting down in the weeds on regex performance!
There is even a weekly competition!