Regular expressions: Difference between revisions

Added basic Mathematica regex demonstration.
(→‎{{header|Groovy}}: matcher-based replacement solution)
(Added basic Mathematica regex demonstration.)
Line 589:
5
a not b ot c
</pre>
=={{header|Mathematica}}==
<lang Mathematica>
StringCases["I am a string with the number 18374 in me",RegularExpression["[0-9]+"]]
StringReplace["I am a string",RegularExpression["I\\sam"] -> "I'm"]
</lang>
The in-notebook output, in order:
<pre>
{18374}
I'm a string
</pre>
 
Line 612 ⟶ 622:
Result 2: This is yet another string
</pre>
 
=={{header|MUMPS}}==
<p>MUMPS doesn't have a replacement functionality when using the pattern matching operator, ?. We can mimic it with $PIECE, but $PIECE doesn't work with regular expressions as an operand.</p><lang MUMPS>REGEXP
Anonymous user