Jump to content
Sign in to follow this  
smellyfingers

$RegExp with user input to change pattern to look for

Recommended Posts

smellyfingers

Hi all, im new to autoit but learning the hard way even if this site makes it easier with all the great ppl.

Anyway i wonder if there is a way to make the $RegExp work like this, if a user types in 15 in a input field and then the

code would look like this $RegExp = StringRegExp ($Clip, "(\d{15})", 1), or if the user types 10 instead the code looks like this, $RegExp = StringRegExp ($Clip, "(\d{10})", 1), so i basically wonder if there is a way to use a variable in the "(\d{10})" field were the {10} is located, thanx in advance!

Share this post


Link to post
Share on other sites
funkey

I don't know exactly what you want, but it is easy to have a variable in the pattern.

$iNum = 10
StringRegExp($Clip, "(d{" & $iNum & "})", 1)

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
smellyfingers

I don't know exactly what you want, but it is easy to have a variable in the pattern.

$iNum = 10
StringRegExp($Clip, "(d{" & $iNum & "})", 1)

Fantastic, i almost did that i just forgot 1 little & , yeah that was exactly what i was looking for, thanx a million :)

Share this post


Link to post
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
Sign in to follow this  

×