But i dont think this will scale very well... (and probably has subtle problems anyway)my $string="123 abcdef"; $string=~s{(\d+)|(\w+)|(\s+)} { defined($1) ? '\\d{'.length($1).'}' : defined($2) ? '\\w{'.length($2).'}' : '\\s{'.length($3).'}' }ge; print $string; __END__ \d{3}\s{1}\w{6}
Yves / DeMerphq
---
Software Engineering is Programming when you can't. -- E. W. Dijkstra (RIP)
In reply to Re: Regular Expression Builder
by demerphq
in thread Regular Expression Builder
by Rich36
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |