johnbo has asked for the wisdom of the Perl Monks concerning the following question:
Your suggestions are welcomed!#!/usr/bin/perl use strict; my $inputText = "word1, word2, #18abcdefgh ,word4"; print "before: $inputText\n"; if ($inputText =~ s/#(\d)(\d{\1})(.{\2})/\<Binary block: $2 bytes\>/) { print "(1) = $1\n"; print "(2) = $2\n"; print "(3) = $3\n"; } print "after: $inputText\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can I use backreferences as quantifiers in a regex?
by ikegami (Patriarch) on Mar 29, 2009 at 07:00 UTC | |
by johnbo (Initiate) on Mar 30, 2009 at 06:07 UTC | |
by ikegami (Patriarch) on Mar 30, 2009 at 06:12 UTC | |
|
Re: Can I use backreferences as quantifiers in a regex?
by eyepopslikeamosquito (Archbishop) on Mar 29, 2009 at 06:32 UTC | |
by ikegami (Patriarch) on Mar 29, 2009 at 07:36 UTC | |
|
Re: Can I use backreferences as quantifiers in a regex?
by educated_foo (Vicar) on Mar 29, 2009 at 16:15 UTC | |
|
Re: Can I use backreferences as quantifiers in a regex?
by ig (Vicar) on Mar 29, 2009 at 08:16 UTC | |
|
Re: Can I use backreferences as quantifiers in a regex?
by JavaFan (Canon) on Mar 29, 2009 at 21:25 UTC |