Currently, I have one issue to match several numbers only.
for example:
my $input1 = "1234 abc test"; - > expect - match and return 1234
my $input2 = " 1234 abc test"; - > expect - match and return 1234
my $input3 = "abc test 1234"; - > expect - match and return 1234
my $input4 = "a1234 test"; not match
my $input5 = "1234- abc test"; not match
my $input6 = "abc 12345 test"; not match
For the above 6 examples, only input1, input2, and input3 need to return 1234. Others will return not matched. How to code the regular expression like that?
I try to do this, but it will not work for input1 and input3.
if $input =~ /\s+(\d{4,4})\s+/{
}