fork download
  1. #!/usr/bin/perl -w
  2.  
  3. use strict;
  4. use warnings;
  5.  
  6. while (<DATA>) {
  7.  
  8. # A - A sequence of digits
  9. # B - A period and a sequence of digits
  10. # C - Repeat 'B'.
  11.  
  12. if (/\b(\d+)((?:\.\d+)+)\b/) {
  13. # ^^^ ^^^^^
  14. # A B
  15. # ^^^^^^^
  16. # C
  17.  
  18. print "[$1] [$2]\n";
  19. }
  20. }
  21.  
  22. __END__
  23. 1.23
  24. 123.456
  25. 1.2.3
  26. 1.22.333.444
  27.  
Success #stdin #stdout 0s 3696KB
stdin
Standard input is empty
stdout
[1]  [.23]
[123]  [.456]
[1]  [.2.3]
[1]  [.22.333.444]