I’m doing some filename scraping with VBS, if the file name was called
hello_world_2012_is_not the end of the world.pdf
then the regex should match the word “world” and nothing else.
I tried this:
[_][^_]+(?=_)
but it gets everything that is between two underscores. How do I only select the first occurrence?
I suggest the following regex:
Explanation:
Then the first capturing group (
$1) will containworld, and the regex won’t match anywhere else in the string.