RegEx Samples & Naming Standards
Are there any examples of Regular Expressions being used in Virtual Views?
Since there are various RegEx standards and since the way the asset selectors work isn't always obvious, I'd love to see some worked examples of common view RegEx expressions.
I might be blind, but I couldn't see anything like that in the online View documentation.
Also, I'm curious - most of the examples use periods (.) between the elements of a points name. This is very readable, but it's a bit chaotic when writing RegExes, since periods have meaning in regular expressions that completely threw me for quite some time.
For example, I have points that look like 'Site.System.Piece.Name.Temperature'. I was wanted to make an asset up-to but NOT including 'Temperature'. Site.System.Piece wasn't enough - but of course, Site.System.Piece.(.+$). doesn't work. the final expression was actually Site\.System\.Piece\.(.+)\., which is a little awkward.
Should 'best practice' be to use underscores, to help avoid confusion between literal periods and the RegEx symbol for 'any character'?
1 reply
-
Hi sharding ,
We use the .NET flavor of RegEx.
It uses the "\" as the escape character.
If you want an example view to see, there is one available in our Project Boot Camp. If you look specifically at the Views article, there are two txt files you can import into a virtual view to see those rules.