|
Posted by Dr.Ruud on January 27, 2008, 11:11 am
Please log in for more thread options Dr.Ruud schreef:
> d99alu:
>> I have a string, and I want to remove everything behind the ">"
>> character. The string contains new line characters that I don't want
>> to remove.
>
> s/(?:<=>).*//s;
>
> See perldoc perlre, search for "look-behind".
I also forgot the newline. Maybe this does what you need:
s/(?<=>).*/\n/s;
(doesn't keep any of the original newlines; even adds one when none was
there)
--
Affijn, Ruud
"Gewoon is een tijger."
|