I was just practicing regex and found something intriguing
for a string
"world9 a9$ b6$"
my regular expression "^(?=.*[\\d])(?=\\S+\\$).{2,}$"
will return false as there is a space in between before the look ahead finds the $ sign with at least one digit and non space character.
As a whole the string doesn't matches the pattern.
What should be the regular expression if I want to return true even if a substring follows a pattern? as in this one a9$ and b6$ both follow the regular expression.