Search code examples
regextensorboardregex-negation

What regex syntax does Tensorboard support for tag and run filtering?


I would like to filter tags with a specific regex. In my case, I'd like to negate a character in the search. I cannot find any README, resources, or github issue that discusses what regex syntax Tensorboard 1.15 supports.


Solution

  • Guessing by the source of Tensorboard, it's using Python's own re module, and the _create_regexp_filter(regex) function specifically uses re.search(). That means it will

    Scan through (the) string looking for the first location where the regular expression pattern produces a match

    Therefore, to exclude tags (or runs) that contain a specific character you need a regex that fails when there is any occurrence. A common pattern to achieve this, e.g. exclude all tags that contain the letter k, is this (for a single character or a character group)

    ^[^k]+$ 
    

    or this (to exclude phrases)

    ^((?!k).)+$