Word Add-in API in Search method not working when region selected Slovenian(Slovenia)

Alpesh Chaudhari 1 Reputation point

Hello Team,
I am using Word API for developing word add-in. I have used search method for searching all number from the word document. When I am using Slovenian(Slovenia) region then this method throw error and if I am using English(United States) then search method working fine.

I have used this regex : [0-9,.]{1,}

Snippet :

var Prange = context.document.getSelection();  
 context.load(Prange, 'text');  
await context.sync();  
var searchResults = Prange.search('[0-9,.]{1,}', { matchWildcards: true });  
context.load(searchResults, 'text,font');  
await context.sync();  

Console Error :

Debug info: {"code":"GeneralException","message":"GeneralException","errorLocation":"","statement":"_Search2.load(["text","font"]);","surroundingStatements":["var v = context.root._getObjectByReferenceId("01D!00000010") /* originally getSelection() /;","var _Search2 = v._Search2(...);","// Instantiate {_Search2}","// >>>>>","_Search2.load(["text","font"]);","// <<<<<","var contentControls = v.contentControls;","// Instantiate {contentControls}","contentControls.load();"],"fullStatements":["var v = context.root._getObjectByReferenceId("01D!00000010") / originally getSelection() */;","var _Search2 = v._Search2("[0-9,.]{1,}", 4);","// Instantiate {_Search2}","_Search2.load(["text","font"]);","var contentControls = v.contentControls;","// Instantiate {contentControls}","contentControls.load();"]}  

When region is English (United States) :


When region is Slovenian(Slovenia) :


Why this same regex is not working for Slovenian(Slovenia) region.
Please provide any solution for this issue.

Office Development
Office Development
Office: A suite of Microsoft productivity software that supports common business tasks, including word processing, email, presentations, and data management and analysis.Development: The process of researching, productizing, and refining new or existing technologies.
2,424 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yun Wang 1 Reputation point Microsoft Employee

    Thanks for reporting this. This problem is tracked via the GitHub issue here: https://github.com/OfficeDev/office-js/issues/2980

    0 comments No comments