Using Pattern in java : <p>I'm practicing with Pattern class in java, and, for example, given a String:</p>

<pre><code>String text = "1234bbbbAAAAb2222 /*1231232132131221*/ [11] }";
</code></pre>

<p>The output should be:</p>

<pre><code>Number: 1234
String: bbbbAAAAb
Number: 2222
Commment: /*1231232132131221*/
Symbol: [
Number: 11
Symbol: ]
Symbol: }
</code></pre>

<p>How could I do this with Pattern using regex, so everything is printed according to the order in the original text ?</p>

<p>My output is not doing in order:</p>

<pre><code>Number: 1234
Number: 2222
Number: 11
String: bbbbAAAAb
Commment: /*1231232132131221*/
Symbol: [
Symbol: ]
Symbol: }
</code></pre>
