ASCII topology pt 1: Can I count on you?
SnakeEx - 98 bytes with Javascript, 44 without

This looked like a good problem to try my language from the Fortnightly Challenge on:

m:({e&lt;&gt;PE}\-[|\-]*&lt;T&gt;\+|[|\-]*&lt;T&gt;)+`\+
e:\+


The best place to try this out is my online interpreter.

SnakeEx matches patterns in text by using "snakes" that move around the text matching regexes. The code reads kind of like a regex, except:


The &lt;T&gt; instruction. That is a direction command that branches the snake left and right from its current direction.
{e&lt;&gt;PE} is like a subroutine call. It that spawns a snake with definition e moving forward (&lt;&gt;) and with parameters P (piggyback - the spawning snake follows the new snake) and E (exclusive - don't match anything that's already been matched). This exclusive check is the only thing that stops the snake from looping infinitely.
The prefix ` at the end indicates that what follows should be matched only if it has already been matched, which we can use to force the loop to close.


Because SnakeEx is like regex and doesn't technically output the results as desired by itself, I guess we need to wrap it in some Javascript calling the interpreter:

function e(s){return snakeEx.run('m:({e&lt;&gt;PE}\\-[|\\-]*&lt;T&gt;\\+|[|\\-]*&lt;T&gt;)+`\\+\ne:\\+',s,1).length}


Edit: fixed it up to work with blutorange's additional test cases