ruby - regex for a pattern at end of string -


i have string looks like:

hello/world/1.9.2-some-text hello/world/2.0.2-some-text hello/world/2.11.0 

through regex want string after last '/' , until end of line i.e. in above examples output should 1.9.2-some-text, 2.0.2-some-text, 2.11.0

i tried - ^(.+)\/(.+)$ returns me array of first object "hello/world" , 2nd object "1.9.2-some-text"

is there way "1.9.2-some-text" output?

try using negative character class ([^…]) this:

[^\/]+$ 

this match 1 or more of character other / followed end of string.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -