In my opinion, Your problem/dataset seems more like a text-processing problem rather than a statistical analysis problem, but still linear regression with some particular dataset can give fairly satisfying results. That means in this case, the regression results depends on the data provided for training such model.
For example, I've generated a dataset of 10,000 samples ranging in [0, 100]. Fitting a straight line will give more accurate predictions for the points which does not contains 4
, because from the below figure, you can see that the straight line(which is result of linear regression) is imposed on such data points but due to the data points which contains 4
, the line is slightly shifted above from the position where it should be. This will be more clear in next example.

Now consider the dataset of 1000 examples of points ranging in [0, 4999].

Due to 4
's in thousands place, we can see more variance in output. This gives even worse results on the data points which do not contains 4
. (You can notice this by observing the resulting line in above graph).
So regression would not be the best choice for such problems.