stlehmann / pyads

Python wrapper for TwinCAT ADS
MIT License
247 stars 93 forks source link

Feature: Expose AmsAddress.RegularExpressionPattern #309

Open rerpha opened 2 years ago

rerpha commented 2 years ago

I would like to validate my AMS addresses against https://infosys.beckhoff.com/english.php?content=../content/1033/tc3_adsnetref/7313118347.html&id= and use pyads for it rather than copy it in and modify to work in python. Perhaps it could live in constants?

RobertoRoos commented 1 year ago

The netid object currently throws a ValueError when the net ID is not valid, when creating a Connection for instance. This is not based on a regex exactly, but a check for 5 periods and whether each group is numeric.

So you could try ... catch in your application.

I don't think we need to expose a regex like this.

rerpha commented 1 year ago

my use case was offline validating, rather than creating a connection, and I was thinking as pyads is effectively a DLL wrapper/abstraction it might be handy to have it included in constants