Extract and compare text

I need to make the 3 digit number a variable before comparing. How do i do that?