dwaynek Posted January 21, 2018 Share Posted January 21, 2018 here's a simple script that i can't get working: $a="1232ssni123.mp4" $result=StringRegExp($a,"\d{4}[A-Za-z]{3-4}\d{3}\.(avi|mp4|wmv|mkv)",0) msgbox(0,"",$result) it should match and produce a result of 1 but it doesn't. what am i doing wrong? Link to comment Share on other sites More sharing options...
iamtheky Posted January 21, 2018 Share Posted January 21, 2018 (edited) you need to say 3 letters for sure, and then maybe one other. I think that range is the only issue, you could do it like so instead: $a="1232ssni123.mp4" $b="1232ssn123.wmv" $c="1232ss123.wmv" ; negative test not enough letters $d="1232ssni123.wma" ; negative test extension msgbox(0,"",StringRegExp($a,"\d{4}[A-Za-z]{3}[A-Za-z]*\d{3}\.(avi|mp4|wmv|mkv)")) msgbox(0,"",StringRegExp($b,"\d{4}[A-Za-z]{3}[A-Za-z]*\d{3}\.(avi|mp4|wmv|mkv)")) msgbox(0,"",StringRegExp($c,"\d{4}[A-Za-z]{3}[A-Za-z]*\d{3}\.(avi|mp4|wmv|mkv)")) msgbox(0,"",StringRegExp($d,"\d{4}[A-Za-z]{3}[A-Za-z]*\d{3}\.(avi|mp4|wmv|mkv)")) Edited January 21, 2018 by iamtheky ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
dwaynek Posted January 22, 2018 Author Share Posted January 22, 2018 thanks! so the range is a bug or something not supported? was driving me crazy. thanks for finding it. Link to comment Share on other sites More sharing options...
iamtheky Posted January 22, 2018 Share Posted January 22, 2018 well no, according to the help file you could have also just exchanged your dash for a comma $a="1232ssni123.mp4" $b="1232ssn123.mp4" msgbox(0,"",StringRegExp($a,"\d{4}[A-Za-z]{3,4}\d{3}\.(avi|mp4|wmv|mkv)")) msgbox(0,"",StringRegExp($b,"\d{4}[A-Za-z]{3,4}\d{3}\.(avi|mp4|wmv|mkv)")) ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
dwaynek Posted January 22, 2018 Author Share Posted January 22, 2018 ohhh silly me, i dunno where i got the idea the dash was for range. thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now