Regular expressions: Difference between revisions
Content added Content deleted
(→{{header|REXX}}: add REXX examples modeled after PERL examples. -- ~~~~) |
m (→{{header|REXX}}: added titles for the REXX programs. -- ~~~~) |
||
Line 1,286: | Line 1,286: | ||
<br><br>It is also possible to emulate regular expressions through appropriate coding techniques. |
<br><br>It is also possible to emulate regular expressions through appropriate coding techniques. |
||
<br><br>All of the following REXX examples are modeled after the '''PERL''' examples. |
<br><br>All of the following REXX examples are modeled after the '''PERL''' examples. |
||
<br> |
|||
'''testing''' |
|||
<lang rexx>/*REXX program demonstrates testing (modeled after Perl example).*/ |
<lang rexx>/*REXX program demonstrates testing (modeled after Perl example).*/ |
||
$string = "I am a string" |
$string = "I am a string" |
||
Line 1,309: | Line 1,311: | ||
It does not contain the word: ring |
It does not contain the word: ring |
||
</pre> |
</pre> |
||
'''substitution (destructive)''' |
|||
<lang rexx>/*REXX program demonstrates substitution (modeled after Perl example).*/ |
<lang rexx>/*REXX program demonstrates substitution (modeled after Perl example).*/ |
||
$string = "I am a string" |
$string = "I am a string" |
||
Line 1,326: | Line 1,329: | ||
The changed string is: I am another string |
The changed string is: I am another string |
||
</pre> |
</pre> |
||
'''substitution (non-destructive)''' |
|||
<lang rexx>/*REXX program shows non-destructive sub. (modeled after Perl example).*/ |
<lang rexx>/*REXX program shows non-destructive sub. (modeled after Perl example).*/ |
||
$string = "I am a string" |
$string = "I am a string" |
||
Line 1,345: | Line 1,349: | ||
The changed string is: I am another string |
The changed string is: I am another string |
||
</pre> |
</pre> |
||
'''test and substitute''' |
|||
<lang rexx>/*REXX program shows test and substitute (modeled after Perl example).*/ |
<lang rexx>/*REXX program shows test and substitute (modeled after Perl example).*/ |
||
$string = "I am a string" |
$string = "I am a string" |