Software Development Kit

Regex in Lexicon?


can you use regular expressions in lexicon files? If so, what's the syntax?

I'm trying to get MyScript to recognize numbers and even though they are defined in a subset knowledge file it does not recognize them. Recognition in general is a lot worse when done using custom lexicon/subset knowledge files instead of the ones provided by the SDK. Why is that so?

Thank you for your answers.

Dear Andrin,

thank you for contacting us.

First, which widget are you using? Single Char, Single Line?
On which OS? iOS, Android, Win10?

Also, what does your SK file look like? Only digits such as 0123456789?
Then, how do you add it into your application? You add it into the assets, update the .conf file on call the proper configuration in the configure function?

Regarding using regular expressions in lexicon files, this is not possible this way but rather the opposite, i.e. you create a ludef file which consists of regular expressions in which you can add terms you want to recognize:

Otherwise, just let me know exactly what you want to do, so that I can create the ludef and provide it.

Best regards,


I'm using the Single Line Widget on Windows 10.

The .sk file looks like this (one line): 0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ.'
And yes, we load add it as a res file and call configure. That seems to work fine.

The idea is to let the user write things in the form of: {keyword} <whitespace> {amount}
For example: INV 5'000.00

Is there a description of the ludef format somewhere? E.g. do strings always have to be enclosed in parentheses?

Dear Andrin,

based on the information you are giving, you could create a ludef such as below:

digit = [0-9]
letter = [a-zA-Z]
dot = .

amount = {digit}{digit}*{dot}{digit}{digit}*
keyword = {letter}{letter}*
result = {keyword} {amount}

Copy it in a file (e.g. myresource.ludef), and drop this latter one in the resource tool:

Deploy the compiled resource file in the assets of your application, update your conf file accordingly and call the corresponding configuration.

Let us know if this helps.

Best regards,


Login or Signup to post a comment