 <p>The following regex <a href="https://regex101.com/r/nQ6oJ1/1" rel="nofollow">does what you're looking for</a>:</p> <pre><code>\d+(?:\s?(?:\$|euro)) </code></pre> <p>In <code>PHP</code> code, this would be:</p> <pre><code>$string ="i have 300 $, 1000$ ,500 euro in my account"; $regex = '~\d+(?:\s?(?:\$|euro))~'; preg_match_all($regex, $string, $matches); print_r($matches); </code></pre> <p>See <a href="http://ideone.com/BCha1a" rel="nofollow">a demo on ideone.com</a>.<br> To actually get the digits (300,1000,500 in your case), you could use a capturing group like so:</p> <pre><code>$regex = '~(\d+)(?:\s?(?:\$|euro))~'; preg_match_all($regex, $string, $matches); print_r($matches); </code></pre> <p>To match other currencies as well (as @Wiktor pointed out), add these to the non-capturing group:</p> <pre><code>(\d+)(?:\s?(?:\$|euro|¥|yen)) </code></pre> <p>To allow <strong>float</strong> values, change the pattern as follows:</p> <pre><code>([\d.]+)(?:\s?(?:\$|euro|¥|yen)) </code></pre>