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

Alpesh Chaudhari 1 Reputation point
2022-11-17T13:30:28.317+00:00

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) :

261417-ss.png

When region is Slovenian(Slovenia) :

261418-ss1.png

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.
3,532 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Yun Wang 1 Reputation point Microsoft Employee
    2022-12-27T03:46:04.107+00:00

    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