ruby - Match as to the right as possible using =~ (regex) -


i'm trying work:

data = "testing: download complete (this string) - priority 0 random value testing: download complete (this to) - priority 0 random value" puts $1 if data =~ /testing: download complete \((.*?)\) - priority.*?$/i 

i want print this to, right this string being printed.

the idea value far right possible.

use

puts $1 if data =~ /.*testing: download complete \((.*?)\) - priority/i 

the initial .* match until end of line, , rest of regex backtrack as needed match. therefore, last possible match found.


Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -