Regular expressions: Difference between revisions

no edit summary
m (→‎[[Python]]: Moved the match() warning out of the code.)
No edit summary
Line 221:
"was"
end)
 
==[[Tcl]]==
[[Category:Tcl]]
 
Test
 
set theString "I am a string"
if {[regexp -- {string$} $theString]} {
puts "Ends with 'string'\n"
}
if (![regexp -- {^You} $theString]) {
puts "Does not start with 'You'\n"
}
 
Substitute
set theString = "I am a string"
puts [regsub -- { a } {I am a string} { another }]
Anonymous user