Jump to content

Regex pattern


 Share

Recommended Posts

Hello,

I have some random paths and i want to get the file at the end of the path. The paths look like this: C:UsersrandomDesktoprandom1random1 updateupdated123whaeverbinyesDirectoryrandomSong.mp3

Which is the pattern to get only this; randomSong.mp3?  Or even better this: randomSong.

Sorry but i am really bad at regex.

 

Edited by AutID
Link to comment
Share on other sites

$sString = "C:\Users\random\Desktop\random1\random1 update\updated\123\whaever\bin\yes\Directory\randomSong.mp3"

$aString = stringsplit($sString , "\")
msgbox(0, '' , stringtrimright($aString[$aString[0]] , 4))

or

$sString = "C:\Users\random\Desktop\random1\random1 update\updated\123\whaever\bin\yes\Directory\randomSong.mp3"

msgbox(0, '' , stringregexp($sString , ".*\\(.+)\.mp3" , 3)[0])
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...