Community
If you are going to use the file name to derive the project number, I use this Deisel expression in my title block attribute editor: $(upper,$(substr,$(getvar,dwgname),1,7))
Our projects are numbered with seven digits first, then name, then dwg name. This allows you to filter out all the text after the project number. You can change this to fit your needs.
In the "Insert Field" dialog use "OTHER" then put this expression in the block on the right.
If you use Sheet Sets, there is a built-in field named CurrentSheetSetProjectNumber that you could also look into using.