Sign in to follow this  
Followers 0
Noobster24

StringRegExp with optional (?)

3 posts in this topic

#1 ·  Posted (edited)

Hi,

say I got this text:

<TD CLASS="COL7G">text1</TD>

<TD CLASS="COL7G">text2</TD>

<TD CLASS="COL7G">text3</TD>

<TD CLASS="COL7">text4</TD>

<TD CLASS="COL7G">text5</TD>

As you can see one is CLASS="COL7", the rest are COL7G.

Well I got this function:

Func _SRE_Between($s_FilePath, $s_Start, $s_End)
    $h_FRead = FileRead($s_FilePath, FileGetSize($s_FilePath))
    $a_Array = StringRegExp($h_FRead, '(?:' & $s_Start & ')(.*?)(?:' & $s_End & ')', 3)
    If Not @error Then Return $a_Array
EndFuncoÝ÷ ØkÊÚ zÛa{m{wõ¶X¤z×±·[^ÆÝ­{wz×,¢g­g¬¶«z+âû{-y§h} /±zYpéÈq©e¶ºw-åG­+4ߧ8

But it still gives me the good text (like text1, text2 etc.) + COL7G"> (I want to get rid of that COL7G">)

Edited by Noobster24

Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I re-wrote that, look in the help file for _StringBetween().

But if you don't want COL7G then...

$a_Array = StringRegExp($h_FRead, '(?s)(?i)CLASS="COL7">(.*?)\</TD', 3)

Edit:

After re-reading what you wrote, I can honestly say I have no idea what you want...

If you want all COL7*wildcard any character">text then...

$a_Array = StringRegExp($h_FRead, '(?s)(?i)CLASS="COL7.*?">(.*?)\</TD', 3)

Will return all COL7* text.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Share this post


Link to post
Share on other sites

I re-wrote that, look in the help file for _StringBetween().

But if you don't want COL7G then...

$a_Array = StringRegExp($h_FRead, '(?s)(?i)CLASS="COL7">(.*?)\</TD', 3)

Edit:

After re-reading what you wrote, I can honestly say I have no idea what you want...

If you want all COL7*wildcard any character">text then...

$a_Array = StringRegExp($h_FRead, '(?s)(?i)CLASS="COL7.*?">(.*?)\</TD', 3)

Will return all COL7* text.

Hmm, I need to update my AutoIt I guess, cause in my helpfile no StringBetween functions exists :rambo:

Thanks for the help (again :rolleyes: )


Programs so far:Teh Serializer - Search for licenses for Nero - Windows - Office - Alcohol etc.

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  
Followers 0