Jump to content
souldjer777

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

Recommended Posts

souldjer777

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
mikell

What is exactly the expected result ?

Share this post


Link to post
Share on other sites
souldjer777

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
mikell

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
souldjer777

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
souldjer777

That one above actually worked... now to figure out the array...

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


"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
souldjer777

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
souldjer777

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
Jury

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
souldjer777

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
Jury

also shouldn't:

$STR_REGEXPARRAYGLOBALFULLMATCH

just be:

3

Share this post


Link to post
Share on other sites
souldjer777

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
Jury

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
souldjer777

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
souldjer777

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


"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
jchd

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
souldjer777

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
jchd

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
mikell

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
souldjer777

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

    • Skeletor
      By Skeletor
      Hi Virtual People,
      My array works perfectly fine. However, what is the best practice if the line in the array doesn't have the correct amount of columns and if I can add a placeholder?

       
      For $count = 1 To _FileCountLines($FileRead1) Step 1 $string = FileReadLine($FileRead1, $count) $input = StringSplit($string, ",", 1) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value2, "A1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value1, "B1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value3, "C1") Next  
    • MrCheese
      By MrCheese
      hi all,
      reviewing the forum, this thread is applicable: 
       
       
      I wanted to know if there is now a better way to do this?
      In essence, I load a tab delimited txt file into an array (works well). I used tab, as some fields in the original csv contains commas.
      However, I needed autoit to manipulate this array, and output it as a csv.
      IF my array contains items with a comma, without double quotes around the field, then how best do I get a csv out of this?
      My current workaround is to filewritefromarray tab delimited, then open it in excel and save as a csv. I will need to check this to see how the address fields behave that contain a comma.
       
      Any thoughts would be appreciated.
       
    • Skeletor
      By Skeletor
      Hi All,

      I would like to know how you would take a FileLineRead and insert it into an array which then inserts it into Excel?
      One thing to know is the files content is broken up, so I only use half of the content within $FileRead1.
      So its imperative that the $value1, $value2, etc variables be used. 
      Code below:
      $FileRead1 = FileReadLine("C:\temp\sample.txt",1) For $count = 1 To _FileCountLines($FileRead1) Step 1 $string = FileReadLine($FileRead1, $count) $input = StringSplit($string, ",", 1) $value1 = $input[1] $value2 = $input[2] $value3 = $input[3] $value4 = $input[4] _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value1, "A1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value2, "B1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value3, "C1") _Excel_RangeWrite($oWorkbook, $oWorkbook.Activesheet, $value4, "D1") Next  
    • AnonymousX
      By AnonymousX
      Hello,
      I'm trying to write a script that moves copies excel cells into an array. I'll than manipulate the values and send array into another program. 
      I don't want range to be specific to a workbook, or sheet, or set of cells.
      I want user to be able to highlight desired cells and to copy either normally ("Ctrl+C") or by a hotkey ("Alt+C"). 
      Could someone help me with this?
      Thank you,
      I've tried to write the framework: (edited)
      #include <MsgBoxConstants.au3> #include <Array.au3> #include <Excel.au3> HotKeySet("!v", "Pastedata") While True Sleep(1000) WEnd func Makearray() local $bArray ;User has cells already copied ;Convert clipboard into an array ;I don;t know how excel stores data to clipboard so don;t know how to bring it into array _Arraydisplay($bArray) MsgBox(0,0,$bArray) return $bArray endfunc func Pastedata() Local $aArray MsgBox(0,0,"wait",1) ;make array based on assumption user has already copied a range to clipboard $aArray = Makearray() ;paste code ;don;t worry about this I got the rest endfunc  
    • Dzenan03
      By Dzenan03
      I want to make a while loop, that creates variables based on a array. For thist I created the array $iDsO with the number and the name of folders in an other folder. Every folder has a different name an I want to create variables(arrays) for each folder that show me all the files in that folder. For example: I have the Folder \Folder1. In it there are the Folders \1, \2, \3. In 1, 2 and 3 there are some files(.png). The array for Folder1 is $iDsO and now I want to crate the arrays $iDsO1, $iDsO2 and $iDsO3 with the files in them can I make something like this:
      While $iDs > 0 ;$iDs is the number of files in Folder1>> $iDsO[0] $iDs#here should come the Foldername for example '1'# = _FileListtoArray(@ProgramFilesDir&"\Folder1\"&$iDsO[$iDs]) $iDs = $iDs - 1 Wend So that in the End I have three variabels ($iDs1, $iDs2 and $iDs3)
       
      Is this posible or if not what could I do instead ( I don´t know the number of folders in Folder1 in the begining).
×