Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to delete from ... to...

Status
Not open for further replies.

PerlElvir

Technical User
Aug 23, 2005
68
Hi all,


How can I delete some text from var?

example

$var="individuelle 77,00 € 505.09 FF";

so now I want to delete and get

$var="individuelle 77,00";
 
Code:
($bit_i_want, $filler)=split /€/, $var;

The & sign may need to be escaped

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
ok thx, but what if I have like this:

$var="ALID-1 77,00 € 505.09 FF - ALID-2 77,00 € 505.09 FF - ALID-3 77,00 € 505.09 FF";

and I want to get only:

$var="ALID-1 77,00 € - ALID-2 77,00 € - ALID-3 77,00 €";

so delete all from € till -

but I dont want this to be array and you never know how many ALID-1 ....ALID-n you will have
 
Hi, here is it:
Code:
$var =~ s/€ \d+(\.\d+)? FF/€/g;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top