Anonymous user
Regular expressions: Difference between revisions
→{{header|Julia}}: shorten julia examples (just solve the problem at hand and don't try to document regular expressions in general)
(→{{header|Julia}}: shorten julia examples (just solve the problem at hand and don't try to document regular expressions in general)) |
|||
Line 834:
=={{header|Julia}}==
{{trans|Perl}}
Julia implements Perl-compatible regular expressions (via the built-in [http://www.pcre.org/ PCRE library]). To test for a match:
<lang julia>
if ismatch(r"string$", s)
println("'$s' ends with 'string'")
To perform replacements:
<lang julia>s = "I am a string"
▲ </lang>
s = replace(s, r" (a|an) ", " another ")</lang>
There are many [http://docs.julialang.org/en/latest/manual/strings/#regular-expressions other features] of Julia's regular-expression support, too numerous to list here.
=={{header|Lua}}==
|