• I didn't mean the code was wrong, just that I didnt post the requirements correctly 😀 lol

    I have altered the example data I originally posted. The first one has 3 prceeding white space then a 1.

    Ref Date pattern PatternLength

    TestRef-AA1/1/2013 1111111 1111111 20

    TestRef-AB10/11/20131 111 1 9

    TestRef-AC3/4/2014 111 111 111 21

    TestRef-AD9/9/2013 11 11 1 19

    The correct output would look like this for the example would be

    Ref Date pattern PatternLength

    TestRef-AA1/1/2013 1111111 1111111 20

    TestRef-AA29/01/2013 1111111 1111111 20

    TestRef-AA5/2/2013 1111111 1111111 20

    TestRef-AA12/2/2014 1111111 1111111 20

    TestRef-AA19/02/2013 1111111 1111111 20

    Let me know if that's correct or enough 🙂

    Thanks again