Trying to Use EasyPatterns...Please Help...

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Trying to Use EasyPatterns...Please Help...

Post by rjw524 » Sun Mar 29, 2015 7:08 am

I have been trying for the last 7 hours to figure out why this EasyPattern isn't working in my code, and I have no idea.

SAMPLE PATTERN:

<h3 title="John Doe, SEX, AGE" class="name"><a class="title" href="/private/record/50920067,-RUO,CAP?searchController=searchV2&searchId=1212163343&pos=14&total=684&searchCacheKey=293aa850-67bc-43f7-baff-26abc91e1f81%2C1Fdl">John Doe, SEX, AGE, </a><div class="badges"><abbr title="John Doe, SEX, AGE is a 1st level resident" class="degree-icon ">2<sup>nd</sup></abbr></div></h3>

REGEX RETURNED USING EASYPATTERNS:

<a class="title" href="/private/record[ longest 1 to 400 digits or letters or <!"#$%&'()*+,-./\:;=?@[]^_`{}~|> ]>[ capture( longest 1 to 50 letters or whitespace or <!"#$%&'()*+,-./\:;=?@[]^_`{}~|> ) ]</a>

Code: Select all

Let>URL=https://www.example.com/count=25

IEGetTags>%URL%,div,H,arrTag

//NOTE: I used the debugger here, and the "arrTag" array showed 639 results. I exploded the array and the tags were indeed pulled correctly


//CODE FOR EASYPATTERN REGEX:

Let>tmp0=<a class="title" href="/private/record[ longest 1 to 400 digits or letters or <!"#$%&'()*+,-./\:;=?@[]^_`{}~|> ]>[ capture( longest 1 to 50 letters or whitespace or <!"#$%&'()*+,-./\:;=?@[]^_`{}~|> ) ]</a>

RegEx>tmp0,arrTag,1,Matches,NumMatches,0,,

MDL>%NumMatches%


NumMatches returns 0 results, when done in EasyPatterns it returned 25 records (which is the correct number)

This is due for a very important project for my job on Monday, and I have no idea why it's not taking this pattern.

Can someone please help? I'm in need of a major save here.

rjw524

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Trying to Use EasyPatterns...Please Help...

Post by Marcus Tettmar » Mon Mar 30, 2015 12:52 pm

Maybe we need to use standard RegEx here. But what is it you want to return? If you can give an example of what you want returned we can work out what RegEx you need.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Re: Trying to Use EasyPatterns...Please Help...

Post by rjw524 » Tue Mar 31, 2015 2:45 am

I'm trying to return:

"John Doe, SEX, AGE"

These are variables. So, it could be "Cate Smith, Female, 31", etc.

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Trying to Use EasyPatterns...Please Help...

Post by Marcus Tettmar » Thu Apr 02, 2015 3:02 pm

So all you need is what appears in the title tag? :

Code: Select all

<h3 title="John Doe, SEX, AGE" class="name">
So all you need is:

Code: Select all

RegEx>(?<=title=").*?(?="),text,0,matches,nm,0
E.g.

Code: Select all

Let>text=<h3 title="John Doe, SEX, AGE" class="name"><a class="title" href="/private/record/50920067,-RUO,CAP?searchController=searchV2&searchId=1212163343&pos=14&total=684&searchCacheKey=293aa850-67bc-43f7-baff-26abc91e1f81%2C1Fdl">John Doe, SEX, AGE, </a><div class="badges"><abbr title="John Doe, SEX, AGE is a 1st level resident" class="degree-icon ">2<sup>nd</sup></abbr></div></h3>

RegEx>(?<=title=").*?(?="),text,0,matches,nm,0
MessageModal>matches_1
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

rjw524
Pro Scripter
Posts: 104
Joined: Wed May 09, 2012 9:45 pm
Location: Michigan

Re: Trying to Use EasyPatterns...Please Help...

Post by rjw524 » Mon Apr 06, 2015 8:33 am

Hi Marcus,

Thanks so much for the assist on this here! I used it the same day you posted it, but I was so swamped that I forgot to come back here to say thanks.

Major help!

rjw

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts