Finding a specific number in a string.
-
I can find plenty of examples of how to find a number in a string, but now how to find a number preceded by a specific string. Like...
[2020-07-24_184102][ACF11B2Y90][CCT]_Cycle0001.csv
How can I say "give me the number that follows the text 'Cycle'?"
-
I can find plenty of examples of how to find a number in a string, but now how to find a number preceded by a specific string. Like...
[2020-07-24_184102][ACF11B2Y90][CCT]_Cycle0001.csv
How can I say "give me the number that follows the text 'Cycle'?"
-
/Cycle\d+\.csv/
You can work these out for yourself quite quickly at RegExr: Learn, Build, & Test RegEx[^]
Thanks Richard. I finally ended up working out the following:
(?<=Cycle)\d{4}
This returns the '0001' like I want. I actually came close to working this out before posting, but failed to notice that I had a space before the \d. Duh.