I have the following file names, and looking to extract the number after "_R"
:
- \FileName_R10.txt => 10
- \FileName_R_10.txt => 10
I have successfully used the regex:
_R_?(\d+)\.txt$
Now, I'm looking to adapt it to work with the following variation:
- \FileName_R10_1.txt => 10
- \FileName_R_10_1.txt => 10
- \FileName_R10_11.txt => 10
I tried
_R_?(\d+)_?\d+?\.txt$
which seems to work for the later examples, but breaks with the first ones.
Thanks.