pcipci-bus

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


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.


Solution

  • 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.