Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 271
  • 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

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

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