docs.unity3d.com
    Show / Hide Table of Contents

    Is Match Formatter

    Use the Is Match Formatter to evaluate regular expressions to control the output. The Is Match Formatter is not included by default. You can add it to the Formatters in the Smart Format Settings.

    Note: In the options part of the formatter, not all RegEx characters are valid, for example curly braces and parentheses aren’t supported. This is because the same parser is used as for all other extensions.

    Diagram showing the breakdown of the Smart String and how each part is evaluated when using IsMatch.

    Example Smart String Arguments Result
    {theKey:ismatch(^.+123.+$):Okay - {}|No match content}
    new Dictionary<string, object>() { {"theKey", "Some123Content"}}
    
    Okay - Some123Content
    {theKey:ismatch(^.+123.+$):Fixed content if match|No match content}
    new Dictionary<string, object>() { {"theKey", "Some123Content"}}
    
    Fixed content if match
    {0:list:{:ismatch(^100|200|999$):{:0.00}|'no match'}|, | and }
    new List<int> {100, 200, 300}
    
    100.00, 200.00 and 'no match'
    {0:list:{:ismatch(^100|200|999$):'match'|'no match'}|, | and }
    new List<int> {100, 200, 300}
    
    'match', 'match' and 'no match'
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023