[Vienna-pm] Ersetzen eines Chars in einem String

Christian Schoeller c_p_s at gmx.net
Sat Feb 28 07:13:12 CST 2004


On Sat, Feb 28, 2004 at 02:02:02PM +0100, Klaus Zahradnik wrote:
> In php habe ich dafür die Funktion ereg_replace(); Gibt es sowas auch in
> Perl?

Ja, moeglich mit dem Ersetzungsoperator s///. Grundsaetzlich arbeitet
er gleich wie m// mit RegExps, die Aenderung ist jedoch, dass nach dem 
zweiten Slash der neue Ausdruck folgen muss.

Beispiel: "I like Perl." 
s/like/love/ gibt den Satz veraendert zurueck: "I love Perl."

	C.

-- 
Christian Schoeller {Student}  | "If there is anything more important
MAIL {mailto:c_p_s at gmx.net}    | than my ego around, I want it caught
HTTP {http://www.yaup.at.tt}   | and shot now."
EBAY {c_p_s!}                  | -A Hitchhiker's Guide to the Galaxys
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 186 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/vienna-pm/attachments/20040228/9ced4532/attachment.bin


More information about the Vienna-pm mailing list