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
Post a Comment