I'm not quite sure what you're asking for. A regular expression for a substitution? Something like this?
#!/usr/bin/perl -w use strict; use warnings; my $str = "this.is.example.text"; print "Before: $str\n"; $str =~ s/^(\w+\.\w+\.)(\w+\.\w+)$/[$1] [$2]/; print "After : $str\n"; __END__ Before: this.is.example.text After : [this.is.] [example.text]
If you're looking for something more sophisticated, then you should show us the code you wrote to solve your problem, and explain why that's not working for you.
If you are looking for something as simple as a regular expression, and I may be wrong about this, but you seem to be asking some very basic questions in your previous threads, then I cannot overstate the usefulness of a good Perl book, like Programming Perl.
In reply to Re: Merging in perl
by gmargo
in thread Merging in perl
by cthar
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |