Forum Discussion

BrtzStfn's avatar
BrtzStfn
New Contributor
8 years ago

regular expression in name mapping template

Hi,

 

I need help to create templates using regular expressions as a match in the active property; in particular I need:

 

1) template A, active property WpfControlAutomationId, value= "match every object with AutomationId non null or empty or whitespace" (C# would be !string.IsNullOrWhiteSpace(value))

 

2) templates B/C/D/...,

  • active property ClrFullClassName, value= "Control specific type" (Button/TextBox/...)
  • active property WpfControlAutomationId, value= "AutomationId is null or empty or whitespace"

 

This way it should match every object with AutomationId with the first template, every other with the type specific template.

 

For the first match I tryed different regex: .+ / (.)+ / ^(?!\s*$).+

For the second: ^$

It seems that it doesn't work anyway, in particular I get a match with the first template for every object or for none of them.

 

Thank you!

  • BrtzStfn's avatar
    BrtzStfn
    New Contributor

    Hi all,

     

    I got a suggestion from SmartBear Customer Care:

     

    "For the first case, \a+ should be enough (at least one alphanumeric character). For case 2 does \b* work? It should match a string which contains 0 or more whitespace characters and nothing else."

     

    It doesn't work at all.

     

    I think regex don't work with template also if they should. 

    I would be glad to have a feedback from someone who tried regex with templates.

     

    Thank you.