Regular expressions: Difference between revisions
Content added Content deleted
(Added Kotlin) |
|||
Line 1,555: | Line 1,555: | ||
# Xxx xxx Xxx xxx |
# Xxx xxx Xxx xxx |
||
</lang> |
</lang> |
||
=={{header|Phix}}== |
|||
<lang Phix>include builtins\regex.e |
|||
string s = "I am a string" |
|||
printf(1,"\"%s\" %s with string\n",{s,iff(length(regex(`string$`,s))?"ends":"does not end")}) |
|||
printf(1,"\"%s\" %s with You\n",{s,iff(length(regex(`^You`,s))?"starts":"does not start")}) |
|||
?gsub(`[A-Z]`,"abCDefG","*") |
|||
?gsub(`[A-Z]`,"abCDefGH","(&)") |
|||
?gsub(`[A-Z]+`,"abCDefGH","(&)") |
|||
?gsub(`string`,s,"replacement") |
|||
s = gsub(`\ba\b`,s,"another") ?s |
|||
?gsub(`string`,s,"replacement")</lang> |
|||
{{out}} |
|||
<pre> |
|||
"I am a string" ends with string |
|||
"I am a string" does not start with You |
|||
"ab**ef*" |
|||
"ab(C)(D)ef(G)(H)" |
|||
"ab(CD)ef(GH)" |
|||
"I am a replacement" |
|||
"I am another string" |
|||
"I am another replacement" |
|||
</pre> |
|||
=={{header|PHP}}== |
=={{header|PHP}}== |