I want to find a way to match a string in a specific pattern:
<not 'self'>._<something>.
This pattern should match these strings
object._attr
a._aaa
And any other strings with that pattern, as long as the first part before the dot ('object' and 'a') is not empty, and is not the literal string 'self'. And the second part after the underscore ('attr' and 'aaa') must not be empty and must contain only word characters. So self._attr, object._ will not be matched.
Currently I'm trying to use negative look-ahead like this
(?!self)\._(\w+?)
But the problem is that this pattern still matches self._attr, since the negative look-ahead matches the empty string before the dot.
How do I actually specify that the first part of the pattern has to be non-empty.
Hopefully I phrased my question well.
Thanks everyone
