afrojojo Posted October 18, 2011 Share Posted October 18, 2011 Hello masters of the regex. I would like your help. I need an expression that would extract the version out of this string. Everything between the last "-" and ".". INPUT: database_name-10182011946-v1.0.2.sql OUTPUT: v1.0.2 Any ideas? Quote Link to comment Share on other sites More sharing options...
joe92 Posted October 18, 2011 Share Posted October 18, 2011 Will every file end as .sql? And will every version number start as v? If so something like: /(v\d\.\d\.\d)(?=\.sql)/ The \d stands for any digit between 0 and 9. The second set of brackets is to make sure it ends with .sql. Quote Link to comment Share on other sites More sharing options...
afrojojo Posted October 18, 2011 Author Share Posted October 18, 2011 Awesome! Thanks. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.