in reply to Regex: matching any Number then a hyphen


What did you try? How did it fail?

use strict; use warnings; use utf8; use Test::More tests => 3; for my $line(<DATA>) { chomp $line; my ($string, $wanted) = split '#', $line; $string =~ s/^(\d+)\s*[-](.*)/$1.$2/; is $string, $wanted; } __END__ 1234 - Foo#1234. Foo 56778 Bar#56778. Bar 9999. Baz#9999. Baz
1..3 ok 1 ok 2 ok 3

Hope this helps!

The way forward always starts with a minimal test.