Regular expressions: Difference between revisions
Content added Content deleted
(→{{header|C}}: + AWK) |
m (→{{header|Tcl}}: formatting) |
||
Line 470: | Line 470: | ||
=={{header|Tcl}}== |
=={{header|Tcl}}== |
||
Test using <tt>regexp</tt>: |
|||
⚫ | |||
Test |
|||
⚫ | |||
puts "Ends with 'string'\n" |
|||
⚫ | |||
⚫ | |||
puts "Ends with 'string'\n" |
|||
⚫ | |||
if {![regexp -- {^You} $theString]} { |
|||
puts "Does not start with 'You'\n" |
puts "Does not start with 'You'\n" |
||
}</lang> |
|||
} |
|||
Substitute |
Substitute using <tt>regsub</tt> |
||
<lang tcl>set theString = "I am a string" |
|||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|Toka}}== |
=={{header|Toka}}== |