Web + Search + Regex not working

WebViewer({
path: ‘/Scripts/webviewer/lib’,
initialDoc: path,

}, viewerElement).then(instance => {
var annotManager = instance.docViewer.getAnnotationManager();
//var doc = documentViewer.getDocument();
const { annotationManager, documentViewer, Annotations } = instance.Core;

const searchListener = (searchPattern, options, results) => {
    debugger;
    // add redaction annotation for each search result
    const newAnnotations = results.map(result => {
        const annotation = new Annotations.RedactionAnnotation();
        annotation.PageNumber = result.pageNum;
        annotation.Quads = result.quads.map(quad => quad.getPoints());
        annotation.StrokeColor = new Annotations.Color(136, 39, 31);
        //annotation.searchPattern = searchPattern;
        //annotation.searchOptions = options
        //annotation.regex = '^\w{3}\.\w{2}$'
        return annotation;
    });

    annotationManager.addAnnotations(newAnnotations);
    annotationManager.drawAnnotationsFromList(newAnnotations);
};

documentViewer.addEventListener('documentLoaded', () => {
    const searchPattern =  'search text';
    // searchPattern can be something like "search*m" with "wildcard" option set to true
    // searchPattern can be something like "search1|search2" with "regex" option set to true

    // options default values are false
    const searchOptions = {
        //caseSensitive: true,  // match case
       // wholeWord: true,      // match whole words only
        //wildcard: true,      // allow using '*' as a wildcard value
        //regex: true,         // string is treated as a regular expression
        //searchUp: false,      // search from the end of the document upwards
        //ambientString: false,  // return ambient string as part of the result
    };

    instance.UI.addSearchListener(searchListener);
    // start search after document loads
    instance.UI.searchTextFull(searchPattern, searchOptions);
    
});

});

I have used below code for searching with Regex. but it is not working. I have also checked with wildcard as well. It is not working in WebViewer

Hello, I’m Ron, an automated tech support bot :robot:

While you wait for one of our customer support representatives to get back to you, please check out some of these documentation pages:

Guides:APIs:Forums:

Hi
I have already review the links.
I have followed below link but it is not working

Hi Akash,

To help diagnose the issue you’re having, could you provide any errors you are seeing in the console log?

Also what version of WebViewer are you seeing this on?

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

Hi @zserviss

We are not getting any error in console. I have added regex in search but it is not working

Can you please look into it?

I’ve been able to reproduce and confirm this issue.

We’ve added the issue to our backlog to be worked on in the future. We don’t have a timeline for when it will be fixed but if it does get fixed we’ll let you know when it’s available in an experimental build to test out and the estimated official release date. If you have a desired timeline for having this issue fixed please let us know and we’ll do our best to work with you on how this can fit into the release schedule.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

Hi @zserviss

Can you please fixed it asap ? Our team is planning for license and this will be blocker for us

Hi Akash,

I will add this issue to our current sprint. I’ll let you know when it is available to test in an experimental build.

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.

Hi Akash,

After doing some testing, I have discovered that our regex and wildcard is working correctly in version 8.8.

What I have found however is when using \ regex commands (e.g \w) in WebViewer you need to add a second \ as an escape character (e.g \\w).

Hope this helps!

Best Regards,
Zach Serviss
Web Development Support Engineer
PDFTron Systems, Inc.