web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

Custom Restrictions regex flags case insensitive

(0) ShareShare
ReportReport
Posted on by 35

Hello. I want to create a restriction that does case insensitive matching. For example, as per docs.microsoft.com/.../regular-expression-language-quick-reference

Pattern \b(?i)a(?-i)a\w+\b

Matches "aardvark", "aaaAuto" in "aardvark AAAuto aaaAuto Adam breakfast"

However when I try this in customer voice I get an error. It doesn't seem to like parenthesis

pastedimage1611673493768v1.png

I have the same question (0)
  • Suggested answer
    Usha Rathnavel Profile Picture
    on at

    Hi there, 

    Customer Voice uses JavaScript Regular Expressions. More details on the patterns can be found here: 

    https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions 

    For example I was able to test the following pattern which tests if the user enters a combination of alphabet followed by a letter:

    \w\d

    Hope this helps. Curious to understand more of your use-case and the question you are using the regex for - are you trying to check if the user (in his text question response) mentions some specific word?

  • JasonBini Profile Picture
    35 on at

    Thanks Usha

    I want to restrict users to input an email address with specific email domain, for example @gmail.com.

    If they want to spell gmail.com, or Gmail.com, or GmAiL.CoM shouldn't matter. I'm not sure how to make the gmail and the com as case insensitive. Right now, the following will restrict them literally to gmail.com

    ^[A-Za-z0-9._%+-]+@gmail.com$

    Any help is appreciated. Thanks!

  • Usha Rathnavel Profile Picture
    on at

    Hey Jason,

    We are checking into this and will get back to you shortly.

  • Verified answer
    Usha Rathnavel Profile Picture
    on at

    Hey Jason,

    Can you try the below? You can define what specific domain you want to check against.

    ^[\w+!#$%&'*+-/=?^_`{|}~.]+\@[gG][mM][aA][iI][lL]([\.])[cC][oO][mM]$

  • JasonBini Profile Picture
    35 on at

    ok that works but it's painful.

    why can't we set flags?

    ^[A-Za-z0-9._%+-]+@(?i)gmail.com$

  • Suggested answer
    Usha Rathnavel Profile Picture
    on at

    Hi Jason,

    Thanks for confirming! I understand it is a roundabout & time-consuming method.

    Currently, we do not support passing flags directly from the regex expression (since technically, the flag is invoked during the regex function invocation). You can submit an idea for CV to provide support for regex flags at aka.ms/customervoiceideas.

    We will add it to the backlog and prioritize the feature depending on the popularity of the idea.

  • JasonBini Profile Picture
    35 on at

    ok I submitted the feature request. Please upvote if you agree: experience.dynamics.com/.../

  • JasonBini Profile Picture
    35 on at

    Hi Usha. The keystroke response time is very slow when answering this question. Takes about 2-3 seconds for the characters to appear, Perhaps it's the regex that's causing the slowness. I can send you the example if you want to check it out, let me know.

  • Suggested answer
    Usha Rathnavel Profile Picture
    on at

    Hey Jason,

    I tried with the gmail example above, and was working fine. Is the issue persistent? if so, please drop a note with the survey id and the regex over email to usrathna@microsoft.com, so that we can investigate more on this.

    Thanks!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 74 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 31 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans