Regular expressions: Difference between revisions
Content added Content deleted
m (→{{header|Web 68}}: removed head/tail redundant new lines,) |
|||
Line 766: | Line 766: | ||
<lang NewLISP >(regex "[bB]+" "AbBBbABbBAAAA") -> ("bBBb" 1 4)</lang> |
<lang NewLISP >(regex "[bB]+" "AbBBbABbBAAAA") -> ("bBBb" 1 4)</lang> |
||
=={{header|Objeck}}== |
|||
<lang objeck> |
|||
use RegEx; |
|||
bundle Default { |
|||
class RegExTest { |
|||
function : Main(args : String[]) ~ Nil { |
|||
string := "I am a string"; |
|||
# exact match |
|||
regex := RegEx->New(".*string"); |
|||
if(regex->MatchExact(".*string")) { |
|||
"ends with 'string'"->PrintLine(); |
|||
}; |
|||
# replace all |
|||
regex := RegEx->New(" a "); |
|||
regex->ReplaceAll(string, " another ")->PrintLine(); |
|||
} |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|Objective-C}}== |
=={{header|Objective-C}}== |