#!/usr/bin/perl use strict; use warnings; # 778252 while(<DATA>) { if ( $_ =~ /(\w+\s*)(\w+\s*)(\w+\s*)/ ) { print "$1 $2 $3"; } } __DATA__ word1 word2 word3 word4 word5 word6 7word 12345 8word *@- 9word
Output:
word1 word2 word3
word4 word5 word6
7word 12345 8word
In reply to Re: global regex
by ww
in thread global regex
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |