Posted on: 11/22/2011 4:02:30 PM | Views : 249

I have this string:  Transfer file to system (test.txt”)
I’m trying to come up with a regular expression that checks a given string for keyword “Transfer”. It’ll extract file name (test.txt) if keyword “Transfer” found, otherwise return nothing.
 This is what I come up with so far, but it doesn’t work: (?(?!^.*Transfer.*$)\W*(?<filename>\S+\.\w{3}(\.\w{2})?)\W*)
Expected  Output:
1. Given sting: “Transfer file to system (test.txt”)”
Match is false (nothing needs to be returned)
 
2. Given string: “File uploaded (text.txt)”
Match, so filename "text.txt" will be extracted.
 
Thank you
...

Go to the complete details ...