Java regex for identifiers (letters, digits and underscores)
<p>Let's say you have given an input which could look like this <code>(identifier1 identifier_2 23 4)</code>.</p>

<p>I want to add a <code>#</code> symbol after every identifier, which can contain letters, digits and underscores. They can only start with a letter followed by variations of letters, digits and underscores. My approach was something like this:</p>

<pre><code>input.replaceAll("[A-Za-z0-9_]+", "$0#");
</code></pre>

<p>However, this also puts <code>#</code> symbols after every single digit which I wanted to exclude. The result should be <code>(identifier1# identifier_2# 23 4)</code>. Is it possible to solve this problem with regex?</p>