07-06-2015 02:51 PM - last edited on 10-25-2024 02:45 PM by Content Cleaner
According to link below, TS support some regular expression. Can anyone provide an example of where to write the regular expressions ?
I might be easier to do it via an external .net module, but if TS supports it, i might go with that.
https://www.ni.com/docs/en-US/bundle/teststand-api-reference/page/tsref/regular-expressions.html
Solved! Go to Solution.
07-06-2015 06:36 PM
If you are using a PropertyObject Search method there is a parameter called SearchOptions. It requires one of the SearchOptions Constants. One of those is called SearchOptions_RegExpr. When this is passed for that parameter then the search text can contain regular expression characters. This is of course 1 example.
What specifically are you wanting. Maybe there is an easier way?
Hope this helps,
07-07-2015 03:22 AM
I wish to take this string:
{x=8.28504, y=0.10767,z=-0.26559}
And get x,y,z values in seperate varibles.
can be done in C# with this regex:
{x=(?<x>-?\d\.\d{5})\,y=(?<y>-?(-|)\d\.\d{5})\,z=(?<z>-?(-|)\d\.\d{5})}
I have made a piece of code for that, however it would be nice to do it directly in TS.
07-07-2015 06:39 AM - edited 07-07-2015 06:41 AM
HI
Yes there is a PropertyObject.Search Member but the result is from SearchResults so i wonder how to use this in executing sequence ?!
What about a simple workaround by using just 4 lines in Exression statement to achive this by using split and trim ?
Regards
Juergen
07-07-2015 11:13 AM - edited 07-07-2015 11:14 AM
@NikolajEgeskovOstergaard wrote:
I wish to take this string:
{x=8.28504, y=0.10767,z=-0.26559}
And get x,y,z values in seperate varibles.
can be done in C# with this regex:
{x=(?<x>-?\d\.\d{5})\,y=(?<y>-?(-|)\d\.\d{5})\,z=(?<z>-?(-|)\d\.\d{5})}
I have made a piece of code for that, however it would be nice to do it directly in TS.
You can also use an Action step with the .NET adapter to directly call the .NET framework regular expression APIs to do this.
Hope this helps,
-Doug
07-17-2015 04:23 AM
Thanks for the support.
I've not yet tried your suggestion Doug, but i intend to.