Regular expressions: Difference between revisions

no edit summary
No edit summary
Line 1,866:
Some older REXXes don't have a   '''changestr'''   BIF,   so one is included here:   ───►   [[CHANGESTR.REX]].
<br><br>
 
=={{header|Ring}}==
<lang ring>
# Project : Regular expressions
# Date : 2018/01/23
# Author : Gal Zsolt [~ CalmoSoft ~]
# Email : <calmosoft@gmail.com>
 
text = "I am a text"
if right(text,4) = "text"
see "'" + text +"' ends with 'text'" + nl
ok
i = substr(text,"am")
text = left(text,i - 1) + "was" + substr(text,i + 2)
see "replace 'am' with 'was' = " + text + nl
</lang>
Output:
<pre>
'I am a text' ends with 'text'
replace 'am' with 'was' = I was a text
</pre>
 
=={{header|Ruby}}==
2,468

edits