Dryden

Help filtering and turning a variable int an array

3 posts in this topic

Hi guys. It has been a long time since I posted here!

So this time I'm doing a program, and at this point I need to filter out some parts of the text and put them in an array, the issue is that not all the text is the same, except for the beginning, the ending and the length.

So for example:

Quote

 

Lorem ipsum dolor sit amet, nam ne case omnis fastidii. Dolorum noluisse vis ei. Id eam veri ORDERBYnumber">OMG7172203</a></td><td title= nobis, ei nam unum iusto, eu sit probo libris. Est duis vidit consetetur no, at diceret gloriatur eam, ORDERBYnumber">OMG9574620</a></td><td title= scripta epicurei pericula ut eos. Bonorum labores cotidieque ORDERBYnumber">OMG8173223</a></td><td title= nam te, est dolor pericula mediocritatem no, veri principes sea ad.


 

So, the only thing that changes are the numbers itself.

 

In this case my variable would look like this:

Array[0]->3

Array[1]->ORDERBYnumber">OMG7172203</a></td><td title=

Array[2]->ORDERBYnumber">OMG9574620</a></td><td title=

Array[3]->ORDERBYnumber">OMG8173223</a></td><td title=

in the end I'm going to filter them out so they look like this:

Array[0]->3

Array[1]->OMG7172203

Array[2]->OMG9574620

Array[3]->OMG8173223

Any help would be much appreciated. Thank you for your time.


"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

Share this post


Link to post
Share on other sites



Either of these RegExp appear to work.

#include <Array.au3>

Local $Data = 'Lorem ipsum dolor sit amet, nam ne case omnis fastidii. Dolorum noluisse vis ei. Id eam veri ORDERBYnumber">OMG7172203</a></td><td title= nobis, ei nam unum iusto, eu sit probo libris. Est duis vidit consetetur no, at diceret gloriatur eam, ORDERBYnumber">OMG9574620</a></td><td title= scripta epicurei pericula ut eos. Bonorum labores cotidieque ORDERBYnumber">OMG8173223</a></td><td title= nam te, est dolor pericula mediocritatem no, veri principes sea ad.'
; Either
$a = StringRegExp($Data, '(?i)ORDERBYnumber">([A-Z0-9]+)', 3)
; or
;$a = StringRegExp($Data, '(?i)\b[A-Z]{3}[0-9]{7}\b', 3)
_ArrayInsert($a, 0, UBound($a))
_ArrayDisplay($a)

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

That's very helpful Malkey, however it can be more than 3.. It could be hundreds. My issue is making it so that that it exports it all, weather the variable contains 3 matches or 30...or 300.

 

EDIT: Wait...

It does that already. Malkey You are a genius. Thank you very much.

Edited by Dryden

"Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life." - Terry Pratchett.

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