Jump to content
Sign in to follow this  
eatfishdk

Help with StringRegExp

Recommended Posts

eatfishdk

Hi

I'm using the script from this topic

http://www.autoitscript.com/forum/index.ph...l=_EnumWireless

There is a piece of code:

If StringRegExp($objItem.Description, "(?i).*Wireless.*Connection") Then $sWirelessList &= $objItem.Description & "|"

Where it looks for a network card with the words "Wireless Connection" in it...

I need it to look for that and another description, say "Broadcom 801.11g" and mayby a third type...

How the heck do I get that to work, I've tried different types of regex but i simply can't it to work....

Please help, Martin

Share this post


Link to post
Share on other sites
zerobazar

If StringRegExp($objItem.Description, "(?i).*\ Broadcom 801\.11g.*") Then $sWirelessList &= $objItem.Description & "|"

should make it , I guess.

The key thing with your example (Broadcom 801.11g) is to not forget to escape the period (.) of the pattern you are looking for, because they have special meaning within the RegEx.

Best Regards.

Edit: typo

Edited by zerobazar

Share this post


Link to post
Share on other sites
eatfishdk

If StringRegExp($objItem.Description, "(?i).*\ Broadcom 801\.11g.*") Then $sWirelessList &= $objItem.Description & "|"

should make it , I guess.

The key thing with your example (Broadcom 801.11g) is to not forget to escape the period (.) of the pattern you are looking for, because they have special meaning within the RegEx.

Best Regards.

Edit: typo

Ok, yes, that was one of my problems. But what if I need it to look for both "Broadcom 801.11g" or "Wireless Connection"..

Is that possible with regex or should I go for a "if then" solution?

The script need to run on different machines with different wireless cards...

Martin

Share this post


Link to post
Share on other sites
zerobazar

Easy.

If StringRegExp($objItem.Description, "(?i).*(Broadcom 801\.11g|Wireless Connection).*") Then $sWirelessList &= $objItem.Description & "|"

Best Regards.

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  

×