in reply to Partial string match -- with a twist.

A potentially better version would have been:

/^(node[0-9]*)/

... notice underlined character ...

... which would force the string node to be considered only if it was anchored to the left-margin of the string, not anywhere in the string.

It is also sometimes necessary to specify that a regular expression should not be "greedy." Normally, a regex will seek the longest substring that matches the pattern ("greedy") when what you actually want is the shortest one.
  • Comment on Re: Partial string match -- with a twist.