Jump to content
souldjer777

StringRegExp - Pattern fails so is there a specific language I should be using?

Recommended Posts

Good Afternoon Everyone,

First and foremost, thank you for doing what you guys do. I use AutoIT almost every day. It helps the world out... so yes, thank you everyone, sincerely.

This is my Regular Expression:

<tr>.*(\n|\n.*\n)^<td>.*\n^<td>.*\d{1,2}\sJune\s2014.[\S\s]*?\n</tr>

or

<tr>.*(\n|\n.*\n)^<td>.*\n^<td>.*\d{1,2}\sMay\s2014.[\S\s]*?\n</tr>

HTML CODE:

</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6296_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6296">OS X Mavericks 10.9.4 and Security Update 2014-003</a></td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks 10.9 to 10.9.3</td>
<td>30 June 2014</td>
</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6293_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6293">Safari 6.1.5 and Safari 7.0.5</a></td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>
<td>30 June 2014</td>
</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6254_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6254">Safari 6.1.4 and Safari 7.0.4</a></p>
</td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>
<td><p>21 May 2014</p>
</td>
</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6248_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6248">OS X Server 3.1.2</a></p>
</td>
<td>OS X Mavericks 10.9.3 or later</td>
<td><p>20 May 2014</p>
</td>
</tr><tr>

This matches html with tags like <tr> , new lines \n as in Line Feed, digits \d, spaces \s, literal strings like "June" and any character .[\S\s]*? between zero and unlimited times.

As I bash my head against the wall - I thank you for your help!

:mad2:

PCRE regular expression engine updated to 8.34

#include <Array.au3>

$test = ""
$test &= '</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6296_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6296">OS X Mavericks 10.9.4 and Security Update 2014-003</a></td>' & @CRLF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks 10.9 to 10.9.3</td>' & @CRLF
$test &= '<td>30 June 2014</td>' & @CRLF
$test &= '</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6293_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6293">Safari 6.1.5 and Safari 7.0.5</a></td>' & @CRLF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>' & @CRLF
$test &= '<td>30 June 2014</td>' & @CRLF
$test &= '</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6254_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6254">Safari 6.1.4 and Safari 7.0.4</a></p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>' & @CRLF
$test &= '<td><p>21 May 2014</p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6248_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6248">OS X Server 3.1.2</a></p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '<td>OS X Mavericks 10.9.3 or later</td>' & @CRLF
$test &= '<td><p>20 May 2014</p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '</tr><tr>' & @CRLF

MsgBox (0,"", $test)

$AppleMonthName = "June"

Local $aArray = StringRegExp ($test, '<tr>.*\n<td>.*\n<td>\d\d\s' & $AppleMonthName & '\s2014</td>\n</tr>', $STR_REGEXPARRAYGLOBALFULLMATCH)

Local $aMatch = 0
For $i = 0 To UBound($aArray) - 1
    $aMatch = $aArray[$i]
    For $j = 0 To UBound($aMatch) - 1
        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 4 - " & $i & ',' & $j, $aMatch[$j])
    Next
Next

$AppleMonthName = "May"

Local $aArray = StringRegExp ($test, '<tr>.*\n<td>.*\n<td>\d\d\s' & $AppleMonthName & '\s2014</td>\n</tr>', $STR_REGEXPARRAYGLOBALFULLMATCH)

Local $aMatch = 0
For $i = 0 To UBound($aArray) - 1
    $aMatch = $aArray[$i]
    For $j = 0 To UBound($aMatch) - 1
        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 4 - " & $i & ',' & $j, $aMatch[$j])
    Next
Next


Exit

 

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Expected result would be either

<tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6293_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6293">Safari 6.1.5 and Safari 7.0.5</a></td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>
<td>30 June 2014</td>
</tr>

...

etc

or

<tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6254_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6254">Safari 6.1.4 and Safari 7.0.4</a></p>
</td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>
<td><p>21 May 2014</p>
</td>
</tr>

...

etc

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Why not just like this ?

#include <Array.au3>

$test = ""
$test &= '</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6296_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6296">OS X Mavericks 10.9.4 and Security Update 2014-003</a></td>' & @CRLF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks 10.9 to 10.9.3</td>' & @CRLF
$test &= '<td>30 June 2014</td>' & @CRLF
$test &= '</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6293_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6293">Safari 6.1.5 and Safari 7.0.5</a></td>' & @CRLF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>' & @CRLF
$test &= '<td>30 June 2014</td>' & @CRLF
$test &= '</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6254_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6254">Safari 6.1.4 and Safari 7.0.4</a></p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>' & @CRLF
$test &= '<td><p>21 May 2014</p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6248_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6248">OS X Server 3.1.2</a></p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '<td>OS X Mavericks 10.9.3 or later</td>' & @CRLF
$test &= '<td><p>20 May 2014</p>' & @CRLF
$test &= '</td>' & @CRLF
$test &= '</tr><tr>' & @CRLF

;MsgBox (0,"", $test)

Local $aArray = StringRegExp ($test, '(?s)<tr>.*?</tr>', 3)

$AppleMonthName = "June"

For $i = 0 To UBound($aArray) - 1
    If StringInStr($aArray[$i], $AppleMonthName) Then MsgBox(0, $AppleMonthName, $aArray[$i])
Next

$AppleMonthName = "May"

For $i = 0 To UBound($aArray) - 1
    If StringInStr($aArray[$i], $AppleMonthName) Then MsgBox(0, $AppleMonthName, $aArray[$i])
Next

 

Share this post


Link to post
Share on other sites

Well that's the kicker... I really want to learn regular expressions so I'm using PCRE 8.34-8.35 UTF-32 now as a regex language... and it works in RegexBuddy... but fails in AutoIT.

<tr>\N*(\n|\n\N*\n){1,2}<td>\N+\n<td>\N*2014\p{Any}*?</tr>

This is sadly blowing my mind.

I'll check out your script and give it a whirl, problem is, I don't use this stuff enough and I need a good source.


"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Thank you Mikell - I appreciate the help!

The reason I can't do just the table row <tr> tags is because that code above is just a snippet / small example of all the html code. I had to find matching dates for month and year.

Thank you though! I think I'm good now. Going to keep testing.


"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Good Morning All

:)

I was hoping someone could tell me what the following code finds blanks... and single tags </td>

Thank you!

#include <Array.au3>
#include <MsgBoxConstants.au3>
#include <StringConstants.au3>

$test = ""
$test &= '</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6296_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6296">OS X Mavericks 10.9.4 and Security Update 2014-003</a></td>' & @LF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks 10.9 to 10.9.3</td>' & @LF
$test &= '<td>30 June 2014</td>' & @LF
$test &= '</tr><tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6293_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6293">Safari 6.1.5 and Safari 7.0.5</a></td>' & @LF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>' & @LF
$test &= '<td>30 June 2014</td>' & @LF
$test &= '</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6254_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6254">Safari 6.1.4 and Safari 7.0.4</a></p>' & @LF
$test &= '</td>' & @LF
$test &= '<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>' & @LF
$test &= '<td><p>21 May 2014</p>' & @LF
$test &= '</td>' & @LF
$test &= '</tr><tr><td><p><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6248_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6248">OS X Server 3.1.2</a></p>' & @LF
$test &= '</td>' & @LF
$test &= '<td>OS X Mavericks 10.9.3 or later</td>' & @LF
$test &= '<td><p>20 May 2014</p>' & @LF
$test &= '</td>' & @LF
$test &= '</tr><tr>' & @LF

MsgBox (0,"", $test)

Local $aArray = StringRegExp ($test, '<tr>\N*(\n|\n\N*\n){1,2}<td>\N+\n<td>\N*\sJune\s2014\p{Any}*?</tr>', $STR_REGEXPARRAYGLOBALFULLMATCH)

Local $aMatch = 0
For $i = 0 To UBound($aArray) - 1
    $aMatch = $aArray[$i]
    For $j = 0 To UBound($aMatch) - 1
        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 4 - " & $i & ',' & $j, $aMatch[$j])
    Next
Next

Local $aArray = StringRegExp ($test, '<tr>\N*(\n|\n\N*\n){1,2}<td>\N+\n<td>\N*\sMay\s2014\p{Any}*?</tr>', $STR_REGEXPARRAYGLOBALFULLMATCH)

Local $aMatch = 0
For $i = 0 To UBound($aArray) - 1
    $aMatch = $aArray[$i]
    For $j = 0 To UBound($aMatch) - 1
        MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 4 - " & $i & ',' & $j, $aMatch[$j])
    Next
Next


Exit

 

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Re UTF did you see this information in the help file for StringRegExp:

"This implementation includes Unicode Category Properties (UCP) support, which allows fine-grain processing of most human languages.
However to maintain compatibility with previous versions and keep matching speed at its best, the UCP support is not enabled by default. You can enable it by prepending the string (*UCP) at the very start of your pattern. When enabled, the UCP setting changes the extend of a number of regular expression elements, as documented below where applicable."

So for example to change all types of dashes to * :

$sFileRead = StringRegExpReplace($sFileRead, '(*UCP)\p{Pd}', '*')

but I don't understand \p{Any}

BTW I see it means:

Match a character from the Unicode category any (any code point, regardless or whether it is assigned)

 

 

Edited by Jury

Share this post


Link to post
Share on other sites

Sweet thank you Jury

:rambo:

\p{Any} matches any character from the Unicode category "any" (any code point, regardless of whether it is assigned)

*? between zero and unlimited times, as few times as possible, expanding as needed (lazy)

Trying your *UCP now...

Nope, no change... (*UCP)<tr>\N*(\n|\n\N*\n){1,2}<td>\N+\n<td>\N+\s\May\s2014\p{Any}*?</tr>

What would you put in place of Any... if my above description helps...

Thanks!

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Just following examples, yes, that's fine - it's an equivalent.

It's actually a 4.
 

Local $aArray = StringRegExp ($OpenSSL01, '(*UCP)<tr>\N*(\n|\n\N*\n){1,2}<td>\N+\n<td>\N+\s\June\s2014\p{Any}+?</tr>', 4)


 

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

what are you getting as out put?  I get something like:
 

</tr> <tr> <td> < a
onclick="s_objectID=&quot;

http://support.apple.com/kb/HT6296_l&quot;;retur
n this.s_oc?this.s_oc(e):true" href='
'http://support.apple.com/kb/HT6296">OSX
Mavericks 10.9.4 and Security Update 2014-003</a> </td>
<td> OS X Lion vlO.7.5, OS X Mountain Lion vlO.8.5, OS X Mavericks 10.9 to
10.9.3</td>
<td>30 June2014</td>


</tr><tr><td><a
onclick="s_objectID=&quot;
http://support.apple.com/kb/HT6293_l&quot;;retur
n this.s_oc?this.s_oc(e):true" href=
"http://suppott.apple.com/kb/H~T6293">Safari
6.1.5 and Safari 7.0.5</a></td>
<td>OSX Lion vlO.7.5, OS X Mountain Lion vlO.8.5, OS X Mavericks vl0.9.3</td>
<td>30 June2014</td>


</tr> <tr> <td> < p>< a
onclick=''s_objectID=&quot;
http://support.apple.com/kb/HT6254_l&quot;;retur
n this.s_oc?this.s_oc(e):true" href='
'http://support.apple.com/kb/H~T6254''>Safari
6.1.4 and Safari7.0.4</a></p>
</td>
<td>OS X Lion vlO.7.5, OS X Mountain Lion vlO.8.5, OS X Mavericks vl0.9.3</td>
<tdxp>21 May2014</p>
</td>


</tr> <tr> <td> < p>< a
onclick=''s_objectID=&quot;
http://support.apple.com/kb/HT6248_l&quot;;retur
n this.s_oc?this.s_oc(e):true" href=
"http://support.apple.com/kb/HT6248">OSX
Server 3.1.2</a> </p>
</td>
<td> OS X Mavericks 10.9.3 or later</td>
<tdxp>20 May2014</p>
</td>
</tr> <tr>

Share this post


Link to post
Share on other sites

Right, that is the output of the first MsgBox... MsgBox (0,"", $test)

But you should also get output from the For Next loop that has a MsgBox in there...

MsgBox($MB_SYSTEMMODAL, "RegExp Test with Option 4 - " & $i & ',' & $j, $aMatch[$j])

I've gotten strange results within that loop...

---------------------------
RegExp Test with Option 4 - 0,0
---------------------------
<tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6296_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6296">OS X Mavericks 10.9.4 and Security Update 2014-003</a></td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks 10.9 to 10.9.3</td>
<td>30 June 2014</td>
</tr>

---------------------------
OK   
---------------------------
---------------------------
RegExp Test with Option 4 - 0,1
---------------------------


---------------------------
OK   
---------------------------
---------------------------
RegExp Test with Option 4 - 1,0
---------------------------
<tr><td><a onclick="s_objectID=&quot;http://support.apple.com/kb/HT6293_1&quot;;return this.s_oc?this.s_oc(e):true" href="http://support.apple.com/kb/HT6293">Safari 6.1.5 and Safari 7.0.5</a></td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>
<td>30 June 2014</td>
</tr>
---------------------------
OK   
---------------------------
---------------------------
RegExp Test with Option 4 - 1,1
---------------------------


---------------------------
OK   
---------------------------

etc...

It's like I'm in a 2D array and it's reading empty values... except when searching for "May" I get different results as well - strange... don't get it.
 

---------------------------
RegExp Test with Option 4 - 0,0
---------------------------
<tr><td><p><a href="http://support.apple.com/kb/HT6254">Safari 6.1.4 and Safari 7.0.4</a></p>
</td>
<td>OS X Lion v10.7.5, OS X Mountain Lion v10.8.5, OS X Mavericks v10.9.3</td>
<td><p>21 May 2014</p>
</td>
</tr>
---------------------------
OK   
---------------------------
---------------------------
RegExp Test with Option 4 - 0,1
---------------------------

</td>

---------------------------
OK   
---------------------------
---------------------------
RegExp Test with Option 4 - 1,0
---------------------------
<tr><td><p><a href="http://support.apple.com/kb/HT6248">OS X Server 3.1.2</a></p>
</td>
<td>OS X Mavericks 10.9.3 or later</td>
<td><p>20 May 2014</p>
</td>
</tr>
---------------------------
OK   
---------------------------
---------------------------
RegExp Test with Option 4 - 1,1
---------------------------

</td>

---------------------------
OK   
---------------------------

 

Edited by souldjer777

"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Jury,

\p{Any} matches any Unicode character. Of course the opposite, \P{Any} never matches.

\p{Pd} matches "dot punctuation" characters (not dashes and like), but \p{Po} does match dashes and a number of "other punctuation" characters.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

Dude, FYI... I have to say I LOVE your "JE SUIS CHARLIE". I remember that like it was yesterday. Unbelievable what the terrorists did... you can never give up freedom of speech or you forfeit your humanity. - Yes, I'll stick to topic for now on... but that's something I've been meaning to say to you.


"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

Share this post


Link to post
Share on other sites

Thanks for all those who paid a high price for their freedom.

Anyway, I also question the need for (*UCP) since I don't see the need for it, at least in the examples given (maybe overlooking something). It doesn't harm to use it anyway if you expect to process anything not english.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

I've gotten strange results within that loop...

Also, why can't I see the array text if I do an _ArrayDisplay ( $aArray ) ?

​1/ For the empty results trouble, use a non capturing group  (?:\n|\n\N*\n){1,2}

2/ $aArray is an array of arrays
_ArrayDisplay($aArray)  doesn't work because it makes a listview and you can't display an array in a listview item  :)

Share this post


Link to post
Share on other sites

Any idea how I start matching a line at say... the sixth character? As in... how do I start matching the beginning of a line like </tr><tr> at <tr> ?

Thanks!


"Maybe I'm on a road that ain't been paved yet. And maybe I see a sign that ain't been made yet"
Song Title: I guess you could say
Artist: Middle Class Rut

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

  • Similar Content

    • By sksbir
      Hi
      Trying this from autoit v3.3.14.5 and SCITE 3.19.102.1901.0 :
      help file , page "Language Reference - Variables" , sample autoit script about maps:

      Maps must be declared before use by defining their scope using the 'Global/Local/Static' keywords. Local $mControls[]
      So is my test script : only with this local declation.
      -check syntax is OK
      - running script : 

      test.au3" (13) : ==> Variable subscript badly formatted.: Local $mControls[] Local $mControls[^ ERROR ->14:51:49 AutoIt3.exe ended.rc:1
      any clue ?
    • By jmp
      i am trying to get number from string using this code :
      #include <IE.au3> $oIE = _IEAttach ("Edu.corner") Local $aName = "Student name & Code:", $iaName = "0" Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If $oTd.InnerText = $aName Then $iaName = $oTd.NextElementSibling.InnerText $iGet = StringRegExpReplace($iaName, "\D", "") EndIf Next MsgBox(0, "", $iGet) it was get number like 52503058
      But, I want to get only student code 5250. (Different student have different code, sometime its 3 digits, Sometime 4)

       
    • By BlueBandana
      Is there a way to output the regex matches into a file?
      I have a script to compare two files and check for regex matches.
      I want to output the matching regex of 'testexample.txt' to another file.
      #include <MsgBoxConstants.au3> #include <Array.au3> $Read = FileReadToArray("C:\Users\admin\Documents\testexample.txt") $Dictionary = FileReadToArray("C:\Users\admin\Documents\example.txt") For $p = 0 To UBound($Dictionary) - 1 Step 1 $pattern = $Dictionary[$p] For $i = 0 To UBound($Read) - 1 Step 1 $regex = $Read[$i] If StringRegExp($regex, $pattern, 0) Then MsgBox(0, "ResultsPass", "The string is in the file, highlighted strings: " ) Else MsgBox(0, "ResultsFail", "The string isn't in the file.") EndIf Next Next  
    • By Blitzkid
      Hello, i want to search several directories for files with the largest numbers behind them (Like "video123") . They dont have a datatype. But there are also files with longer names and datatypes in these folders (Like "video778.mp4"). Is it possible to filter the _FileListToArray Syntax from
      to smth. like
       
      Here is my Code
      #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <array.au3> #include <File.au3> $filedir = @ScriptDir & "\" _checkfile() Func _checkfile() ConsoleWrite("______________________" & @CRLF) Local $arr[3] = ["music", "picture", "video"] For $i = 0 To UBound($arr) - 1 Local $arrayfiles = _FileListToArray($filedir & $arr[$i], $arr[$i] & "*", 1) If @error = 1 Then ConsoleWrite($arr[$i] & "Error 1") EndIf If @error = 4 Then ConsoleWrite($arr[$i] & "Error 2") ;Exit EndIf $arrayfilter = _ArrayMax($arrayfiles, 0, 1) Global $stringfiles = StringReplace($arrayfilter, $arr[$i], "") ConsoleWrite($arrayfilter & @CRLF) Next EndFunc ;==>_checkfile  
    • By jmp
      Script running good but error in line 7.
      When i run this script :
      #include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection ($oIE, 1) $aTableData = _IETableWriteToArray ($oTable) For $inumber = 1 To UBound($aTableData) -1 $table = $aTableData[4][$inumber] MsgBox(0, "", $table) Next I got Error: array variable has incorrect number of subscripts or subscript dimension range exceeded
×
×
  • Create New...