none
Regex - Skip Characters to match RRS feed

  • Question

  • Hi everyone

    I’m having an issue with Regex.

    I’m trying to make a match of T0000001 (2, 3 and so on) from imports from an MT940 file. We can test our matching facility in Regex.

    However, some of the lines it searches in Regex has what I can only describe as positioners. These are shown as a question mark, followed by 2 digits, such as ?21 or ?22. These positioners describe a position of the text in the document if it were to be printed off the website and they can be anywhere in the file.

    Example:

    T123?214567
    T?211234567

    I need to disregard the positioner and match T1234567.

    From what I can see, this is not possible. I have looked everywhere and tried numerous attempts. (Look behind/aheads etc)

    The creators cant even confirm the flavour of Regex it is - they believe its Python but I’m unsure. There is no option for replacement either etc.

    Unfortunately none of the codes below have worked so far. I thought to test each code in live (Rather than via regex thinking may work different but unfortunately still didn’t work)

    Tried and tested methods:

    T((?21)?\d)+
    ^(T\d*)?\d{2}(\d*)$
    T[0-9]{7}|T[0-9(?\d\d)]{10}
    T\d*(?<=?\d{2})\d+
    \b(T\d*)(?:?\d{2})?(\d+)\b
    (T.?)?\d{2}(.)
    (T(?:\d{7}|[@\d]{8}))\s

    Not even sure if this would be an appropriate Q&A site for this kind of thing but I was recommended to try here.

    Appreciate any help you can provide.

    Kind regards

    Wednesday, April 11, 2018 6:59 AM