• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 273
  • Last Modified:

I need a regular expression

Hi!

i've got this line stored in a perl variable named $size:

4       /mail/lalalala.net/wbiz100332-m92

I want to keep only first number, this number can have from 1 to 4 digits (it's size in Kb)... what regular expressions can i use for this?

Thanks in advance!
0
morsa801tons
Asked:
morsa801tons
1 Solution
 
biraCommented:
echo $size |cut -c1-4
0
 
chris_calabreseCommented:
$size ~= /^(\d+) /;
my $fubar = $1;

or

$size ~= s/ .*//;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now