This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Regular Expression - M-FIles Text Analytics

Hi,

I'm not a developer, but I'm trying to configure the M-Files Text Analytics. :). In a document (Contract) is a text Contract No. After that text is a number. A want to add that number to a property definition. So, basically, I want to add a value after the "Contract No." and before the first space.

I've been searching on the internet for the last 3 hours, but I have nothing to show Disappointed

Any help would be appreciated.

Below is the script from the MF Text Analytics:

{
    "targetName": "ContractNo",
    "documentContentPattern": "THIS IS WHERE I WANT TO PUT THE REGULAR EXPRESSION",
    "comment": "PArtnerjeva številka pogodbe",
    "enabled": true,
    "forceSetValue": true
}

BTW, is that even doable in MF Text Analytics?

Best, Uros

Parents
  • Hi Uros,

    It is certainly doable. Something like this should work for you:

    "(\\bContract\\sNo\\.\\s*(?<value>\\d{5}\\b))",

    The {5} indicates the number of digits. Change it to fit your situation or replace '{5}' with '+' , if Contract No. does not have a fixed number of digits.

    Checkout http://www.ultrapico.com/expresso.htm for a tool to test your expressions against real world text samples. Remember that you need to double each backslash in M-Files because the expression is placed in JSON code. There are plenty of websites with explanations on regex, so folks like us can learn the basics relatively fast, if we set our mind to it Relaxed

    RB, Karl

  • Karl, thx a lot. The beer is on me if we ever meet Slight smile

    "Remember that you need to double each backslash in M-Files because the expression is placed in JSON code. " THX for that explanation. Now I know why so many cases were marked as errors.

    Best, Uros

Reply Children
No Data