How to determine if a string is a valid PCI address?

293 Views Asked by At

PCI addresses adhere to the BDF notation

What would be a good way to determine if a string contains a valid PCI address? Any programming language would do.

1

There are 1 best solutions below

0
omer On BEST ANSWER

So I came up with the following regex (javascript) to cover the basic BDF:

^([a-fA-F0-9]{2}|[a-fA-F0-9]{4}):[a-fA-F0-9]{2}\.[a-fA-F0-9]{1,2}$

extending it to cover the extended versions of BDF should not be that hard.