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

M-Files Text Analytics

Hi,

I am trying to configure the M-Files Text Analytics. The Subscription ID is present in my document (for example, Subscription ID: 919-23456789), and I'm attempting to analyse and add it to a metadata field which is text datatype.

Although I've tried many documentcontentpatterns, none of them have been able to analyse the subscription ID of the relevant documents.

If someone could help me with this, it would be greatly appreciated.

Here is the M-Files Text Analytics script:

{
"targetName": "Subscription ID",
"documentContentPattern": "Subscription ID:\\s*919([+-]?(?=\\.\\d|\\d)(?:\\d+)?(?:\\.?\\d*))(?:[Ee]([+-]?\\d+))?",
"comment": "Analyze the value after 'Subscription ID:' (For eg: 919-23568976) following the document pattern content.",
"enabled": true,
"forceSetValue": true,
}

BR,

Umesh

  • Just noticed that I have forgotten curly brackets around the number of digits in the year part. It should be:

    \d{1,2}-\w{3}-\d{4}\s+(?<value>\d+)\s+$.+

    Have you found a solution to pick which of the results you want to capture? Your input has multiple instances with quantity.

  • Hi Karl

    As I am looking to capture all the quantity field that are listed in the table. I am not sure if that is something that text analytics can analyse. I have also tried the above script with curly brackets on but no luck.

  • Yeah, well I also forgot to put a backslash in front of the $ character. I had forgotten that $ has a special meaning in regex.

    \d{1,2}-\w{3}-\d{4}\s+(?<value>\d+)\s+\$.+

    This regex has been tested in Expresso, and it will provide two results from your example above. Not sure how M-Files will respond to that.

    Please note the function in Expresso where you can type or paste a sample text and then run a match to see if your regex produces the desired results.
    There are plenty of good reference sheets for regex on the web. Print one out and keep it at hand when experimenting with regex. It can be rather tricky at first!

  • Hi Karl

    Finally, I got a desired quantity from the documents.

    Thank you so much for your suggestions. I would definitely get a reference sheet for regex before i experiment other documents.

    I really appreciate your help mate.