Question

If I have this regular expression: (\&file=[A-Z]{4}\d{4}\/)

but I have this search text: &file=PSYC4534/SecretSuccess_512k.flv where the file name for the .flv can be anything.

How can I complete the above expression to include ANY filename.flv?

Thanks

Was it helpful?

Solution

You could use

(\&file=[A-Z]{4}\d{4}\/).*?\.flv(\s|$)

.*?\.flv(\s|$) will match any character (except a newline) zero or more times, as few times as possible, until .flv appears followed by a space character or the end of string.

OTHER TIPS

Something like [a-zA-Z_0-9]+\.flv will match a sequence of one or more of the characters inside the square brackets and the extension. I put in the alpha and digits and the underscore. You may need some more but don't put in a dot/period.

Add this to the end of your expression (\&file=[A-Z]{4}\d{4}\/) but inside the parens.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top