How Would I write this Regular Expression?

63 Views Asked by At

How would I write a Regular Expression for this?

Backup 1 of (anything here, maybe multiple words).html

I thought it would be this

Backup\s1\sof(.*)\.html

but it's not working. I'm using power grep... am I supposed to put something at the beginning and end? Thanks!

1

There are 1 best solutions below

0
budi On
^Backup\s\d+\sof\s\([^\(\)]+\)\.html$
  • ^ assert start of string
    • Backup matches characters "Backup"
    • \s matches any whitespace character
    • \d+ matches one or more numbers
    • \s matches any whitespace character
    • of matches characters "of"
    • \s matches any whitespace character
    • \( matches character '('
    • [^\(\)]+ matches one or more characters not including '(' or ')' characters
    • \) matches character ')'
    • \. matches character '.'
    • html matches characters "html"
  • $ assert end of string