I have here a sample source path:
I want to extact the
how can I do that?
I already tried
|rex field=source "G:\\OperationData\\Ntr_RdngANI\\Work_Bill\\Dis_Rec\\03_12\\Fun_(?\d+)_successful.txt"
but it doesn't work, I think its about the
can someone help me with this?
I believe there are two errors in your expression: a) you need to escape your backslashes, and b) you did not give your capture group a name. I can reccomend https://regex101.com/ to confirm your regular expressions.
In your case, your path contains double backslashes and you need to escape both of them, so your regex looks like
| rex field=source "G:\\\\OperationData\\\\Ntr_RdngANI\\\\Work_Bill\\\\Dis_Rec\\\\03_12\\\\Fun_(?\d+)_successful.txt" - the
capture in angular brackets being the name of your capture group, and
\\\\ as a literal
Hope this helps. And you should really give the page mentioned above a try!
What jeffland said about double backslashes and naming your capturing group was correct. Instead of using the full path as regex pattern, why don't you focus on the file name instead? Something like this:
I've tested it and you can get what you wanted.