Jump to content

Recommended Posts

Posted

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?

Posted (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 by iamtheky

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

Posted

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)"))

 

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

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
×
×
  • Create New...