Serge314 has asked for the wisdom of the Perl Monks concerning the following question:
Hello,
How we can separate a backreference from a digit?
print "Match1\n" if "aa1" =~ /^(a)\1(#)1$/; # comment not works print "Match2\n" if "aa1" =~ /^(a)\1.{0}1$/; # works, but it's very ug +ly print "Match3\n" if "aa1" =~ /^(a)\1 1$/x; # works, but I don't want + to use x modifier... print "Match4\n" if "aa1" =~ /^(a)\g{1}1$/; # works, but since Perl 5 +.10...
Regards
Serge
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How we can separate a backref from a digit?
by ikegami (Patriarch) on Mar 18, 2011 at 07:17 UTC | |
by Serge314 (Acolyte) on Mar 18, 2011 at 07:58 UTC | |
by ikegami (Patriarch) on Mar 18, 2011 at 07:59 UTC | |
by Serge314 (Acolyte) on Mar 18, 2011 at 08:06 UTC | |
by Jenda (Abbot) on Mar 18, 2011 at 11:13 UTC | |
| |
by ikegami (Patriarch) on Mar 18, 2011 at 08:14 UTC | |
|
Re: How we can separate a backref from a digit?
by BrowserUk (Patriarch) on Mar 18, 2011 at 07:30 UTC | |
| |
|
Re: How we can separate a backref from a digit?
by JavaFan (Canon) on Mar 18, 2011 at 10:02 UTC | |
|
Re: How we can separate a backref from a digit?
by Anonymous Monk on Mar 18, 2011 at 07:14 UTC |