regex - How to capture whatever is between an integer and its successor -


how can capture whatever content between integer , successor? example, suppose capture b3c, between 1 , 2 in a1b3c2d. code below gives b3c2d.

'a1b3c2d' =~ / (\d+) (.+) (?{ $1 + 1 }) /x;  print $2, "\n"; 

you need two question marks in construct. 1 puts value of code $^r , returns match

'a1b3c2d' =~ / (\d+) (.+) (??{ $1 + 1 }) /x;  print $2, "\n"; 

output

b3c 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -