New to Zenno, Need Help with Regex

allsystems

Client
Регистрация
08.07.2013
Сообщения
81
Благодарностей
1
Баллы
8
Hi Guys,

Im new to Zenno and I am currently using the demo version. I have to say that this looks like a powerful piece of software and I will be investing in the Pro version soon. I am currently working on a very simple program. I just need Zenno to go to a website and enter a URL and save the URL that I entered along with the result.

I have figured out how to set variables and save the results into a CSV file. The result that I am trying to copy appears different on each page so for example if the results is positive it appears green text, if its negative it appears red and if its midrange it appears orange text. The reason I mention this is because the website is based on PHP and each color text has a different class so I can't use the 'To actions deisgner'. I have included the snippet below:


<div class="report-status-box status3">
<p class="text24 nomargins">
<b class="green-text the-tooltip top center width-300-center black">
4%
<span><a href="/about-our-products/">Read here</a> to learn more about our products </span>

</b>
and service
</p>
<p class="text14 nomargins" id="total_sources">that appears in
<b>2 Sources</b>
</p>
</div>


The area that I am targetting is highlighted in bold and the text I want is in green. I want to make a regex that searches after the text 'top center width-300-center black">' as this appears on all pages regardless of colour of result and ends before the '<span>'. I think this will get me the result of 4%. Can you guys help me to do this please, whats the Regex to use and how do I input this into Zenno as a variable? Whats the logic behind the Regex you use?

Really appreciate the help and I hope to contribute back as I begin to learn more.
 

allsystems

Client
Регистрация
08.07.2013
Сообщения
81
Благодарностей
1
Баллы
8
Just an update to this question, do I need to learn C# Regex to be able to understand how to use Regex in Zenno?
 

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
1. Take class of b tag, in your example it is green-text the-tooltip top center width-300-center black, put it to {-Variable.class-}
2. Word processing regexp:
text for parsing: {-Variable.class-}
pattern: green
results to: {-Variable.result-}
3. Logic IF:
'{-Variable.result-}'!=''
if yes - it is what you are looking for
 
  • Спасибо
Реакции: allsystems

Hungry Bulldozer

Moderator
Регистрация
12.01.2011
Сообщения
3 441
Благодарностей
831
Баллы
113
C# is for more and more advanced things only. TO accomplish these tasks you should have no special skills
 

allsystems

Client
Регистрация
08.07.2013
Сообщения
81
Благодарностей
1
Баллы
8
Thanks for the reply Hungry Bulldozer but this wont work. In the example above it would work because it is using the green class. If for example the results is 60% then the class would change to a 'red' class so Zenno would stop because of error. This is why I want to match all text that comes after top center width-300-center black"> and finishes before <span> as this is shown on all the pages regardless of the colour of the class/result. Do you also have a guide on regex to use in Zenno as the Regular expressions wizard isnt working, probably because I have the demo at the moment.
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 706
Баллы
113
  • Спасибо
Реакции: allsystems

allsystems

Client
Регистрация
08.07.2013
Сообщения
81
Благодарностей
1
Баллы
8
Thanks Hungry Bulldozer and rostonix. Hungry Bulldozer I do appreciate that you took the time to make me the sample file in Zenno however the file is taking a snippet that is just slightly longer than what I wanted and I need to learn how to do this on my own. Rostonix thanks for that, it worked perfectly, I don't know what the issue was before but I think it was because I did not select the line break and shortest match. I have another question now. How to add this so that the value is returned as a variable which I can then use to save in a CSV file. Sorry for all the questions but I am a newbie and eager to learn. I have been going through the Wiki and I could not find a complete guide on what the 'To actions designer' does. Is there a complete guide on it and how to use it?
 

rostonix

Известная личность
Регистрация
23.12.2011
Сообщения
29 067
Благодарностей
5 706
Баллы
113
You perform Word processing - Regex.
In text field you put {-Page.Source-} variable and choose the name for result variable.
Then you just operate with Table processing - Add line and put this result variable there.
 

Кто просматривает тему: (Всего: 1, Пользователи: 0, Гости: 1)