CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Regular Expressions: Re: [kaza_perl] How to match a function of back reference?: Edit Log



Laurent_R
Veteran / Moderator

Jun 6, 2013, 11:21 AM


Views: 11619
Re: [kaza_perl] How to match a function of back reference?

Consider this session under the debugger:


Code
  DB<25> print $s; 
some_string_1_more_string_0_last_string

DB<26> ($c, $d) = $s =~ m/^some_string_(\d+)_more_string_(\d+)/;

DB<27> print "true! \n" if $c == $d + 1;
true!


Quite easy, isn't it?

But the calculation within the regex, I don't think you can do that.


(This post was edited by Laurent_R on Jun 6, 2013, 11:22 AM)


Edit Log:
Post edited by Laurent_R (Veteran) on Jun 6, 2013, 11:22 AM


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives