I have strings
some.text.S**01**E02.partofstring.mkv
some.textstring.S**01**E02.partofstring.mkv
I need to extract the numbers between S and E. In those filenames always are two digits.
Use a regex with a capture group: .*?S.*?(\d{2}).*?E.*
> "some.text.S**01**E02.partofstring.mkv" -replace '.*?S.*?(\d{2}).*?E.*','$1'
01
> "some.textstring.S**01**E02.partofstring.mkv" -replace '.*?S.*?(\d{2}).*?E.*','$1'
01