user897237
user897237

Reputation: 623

Easy regular expression- please correct

I have AUD0.7195. I want to mach AUD in $1 and 0.7195in $2. The amount may vary. It can be positive integer. I have tried with:

 /([A-Z]{3})(\d{+}\.?\d*)/ms;

But it matches nothing. What is wrong? Thanks!

Upvotes: 0

Views: 51

Answers (3)

ssr1012
ssr1012

Reputation: 2589

Could you please try this:

my $string = "AUD0.7195";
print "$1\t$2.......\n", if($string=~m/^([\w]{3})([0-9\-\.]*)$/g);

Upvotes: -1

vks
vks

Reputation: 67988

([a-zA-Z]+)(\d+(?:\.\d+)?)

Use this.Yours does not work as \d{+} does not act as quantifier.

Upvotes: 2

knittl
knittl

Reputation: 265668

\d{+} doesn't make sense and should be \d+

Upvotes: 1

Related Questions