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 dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to extract data between two number

Status
Not open for further replies.

PerlElvir

Technical User
Aug 23, 2005
68

Actualy I need also and numbers.

So I have:


$date = 10 déc. 2005

how I can get

$day = 10
$month = déc.
$year = 2005
 
Code:
my ($day, $month, $year) = /(\d+)\s+(\S+)\s+(\d+)/;
You have given us little to go on so this code will work in this situation but might not work in your code.
If you need something more specific then you should supply a better context.
[/code]


Trojan.
 
problem is that ($date = 10 déc. 2005) is a text not date and I want from this text to make date 10.12.2005.

déc is special character for dec(decembre), but here is problem just how I can extraxt (10 déc. 2005) in 3 parts

so I need

$var1- 10
$var2- déc.
$var3- 2005

Thanx anyway :eek:)
 
Then you need a lookup for the months.
I've given you the code that will split the date up for you.
But if in doubt, here's another simpler one:
Code:
my ($var1, $var2, $var3) = split (/\s+/,$date,3);
Personally I would have stuck with $day, $month and $year but that's up to you.


Trojan.
 
my ($var1, $var2, $var3) = split (/\s+/,$date,3);

Im try this but :( I'll try later I have to go :) thanx anyway
 
well this dont work. I get for $var1 all "10 déc. 2005" for $var2 and $var3 nothing :(
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top