Sure. That's pretty easy:
find . | grep -P '^\./[^/]*$'
... where obviously the 'find' command I'm using just to illustrate what you described. The regex works as follows:
^
and $
are anchors specifying (respectively) the beginning & end of the line. All content must be between those two characters
\./
is a literal period followed by a literal forward-slash
[^]
is a character-class that disallows anything after the ^
and before the ]
- The
*
after [^/]
says to allow zero or more occurrences of that character class
You could also do it like this:
dosomething | grep -P '^[^/]*/[^/]*$'
This will allow only a single /
on the line, in any position on the line (even first or last character).