For what it's worth though, the Scanner class (JDK 5+) does cache the patterns it uses.
Also, bear in mind that there's an excellent chance that the time required to create and GC these Patterns may be insignificant relative to other things in your code. So like most performance concerns, it's probably best to not spend much time on it unless or until you've got an observable performance problem.
"I'm not back." - Bill Harding, Twister
Joined: Sep 26, 2003
Once again thank you for your adequate and quick responses. Very helpful! Jeroen.