refactor: use named regex constants over inline literals (#22964)