Jump to content
Sign in to follow this  
dcop

Wildcard StringRegExp

Recommended Posts

dcop

Here are 2 strings that exist just like this...

<TD>Matt Kenseth</TD>|<TD>Jimmie Johnson</TD>

I would like to match them just using substring and I want to do it with StringRegExp

Heres what I have

<codebox>

If StringRegExp($aPicks[$i], ' (Kenseth|Johnson)') <> 0 Then _ArrayDelete($aPicks, $i)

</codebox>

I've tried many things but I guess I just dont get it.

TIA, Dennis

Share this post


Link to post
Share on other sites
dcop

So?

#include <Array.au3>

$var = "<TD>Matt Kenseth</TD>|<TD>Jimmie Johnson</TD>"
$a = StringRegExp($var, '<TD>(.*?)</TD>', 3)

_ArrayDisplay($a)
I am sorta of accomplishing that with....

CODE
If StringRegExp($aPicks[$i], '(<TD>Matt Kenseth</TD>|<TD>Jimmie Johnson</TD>') <> 0 Then _ArrayDelete($aPicks, $i)
...but I would like to just match the short string I mentioned and the string with TD's may not always be consistent but the kenseth and johnson will.

Share this post


Link to post
Share on other sites
ProgAndy

try this pattern:

"(Kenseth)|(Johnson)"

the or-operator just works for the 2 characters left/right of it. If you want to use it for multiple chars, you have to group them (non-matching groups work, too: "(?:Kenseth)|(?:Johnson)" )


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites
dcop

try this pattern:

"(Kenseth)|(Johnson)"

the or-operator just works for the 2 characters left/right of it. If you want to use it for multiple chars, you have to group them (non-matching groups work, too: "(?:Kenseth)|(?:Johnson)" )

Thnan Andy!

"(?:Kenseth)|(?:Johnson)|(?:Gordon)|(?:Logano )|(?:Edwards)" worked great!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.