Good day stack overflow.

I'm a noob in using regex and here is my problem - I need to check a password if it contains 4 consecutive characters. so far what I have just covered is regarding the digits. Here is my regex:

ascending digits - ^.?(?:0123|1234|2345|3456|4567|5678|6789).$

descending digits - ^.?(?:9876|8765|7654|6543|5432|4321|3210).$

This works only for the digits. I know this is already an overkill in regex so I dont want to do it with the letters. It will be waaay too overkill if I do that.

abcdblah //true because of abcd

helobcde //true because of bcde

dcbablah //true beacause of dcba

heloedcb //true because of edcb

Any help would be highly appreciated. Thanks stackoverflow.


Question: Predicting dichotomous outcome of temporal data set with covariates
Answer: If you have a LARGE data set, there might be something in the machine learning literature to help you. View it as a classification problem. But since this is a medical example, I suspect the total number of patients is fairly small.

In that case, your best hope lies in being able to specify a model for the time-dependent stuff. For example, if a simple regression relates Day to Blood Value, you could compare the estimated slope parameter to outcome: 2 groups; simple t-test. If you have additional covariates, you could include them as well. You would then have a logistic regression with your slope parameter and covariates in the model. You could fit a more complex functional form if needed. 

You might be able to model the blood value component in other ways: try a principal components analysis, and if most of the variation appear to be on the first component, replace the whole series of observations with the PC score. Then proceed as before with a logistic regression. 

If you had the same number of "repeated observations" for each patient, you could try a discriminant analysis. This is similar to the PCA mentioned above, except that the components are chosen to best distinguish between the two dichotomous outcome of the last day. 

Whatever you do, you can estimate your model from one portion of the data set and test it on the other part -- see how well you can actually predict the outcome.