Regex line break.

s41mm3r

Client
Регистрация
23.01.2013
Сообщения
47
Благодарностей
3
Баллы
8
Hey guys,

Need help with the regex section, so I'm trying to parse for a specific element to assign as a variable and use in a "if" step. The html has line breaks in it though and when I activate the "enable line breaks" option this seems to make no difference.

This is the code:

<li class="dashboard_queued_post count_14">
<a href="/blog/yftwenyphten1971/queue" class="queue">
<div class="hide_overflow">Queue</div>
<span class="count">14</span>
</a>

I'm after the number 14 in this case, if I search for <span class="count"> before text and </span> after text it finds 4 different options and I've noticed zp can be a bit buggy at times so don't wanna say to it to grab the 3rd one incase it decides to grab the wrong one whilst running the template.

So I tried telling it to search for <div class="hide_overflow">Queue</div> before and </span> after and it finds <span class="count">14

See the problem here!! In regex my code looks like:

(?<=<div\ class="hide_overflow">Queue</div><span\ class="count">)[\w\W]*?(?=</span>)

Whilst it's like that it finds nothing, I've searched google and can't seem to find anything that works.. This is like the last step I need for the template to be complete and has been driving e crazy for the last few hours, any help will be appriciated.
 

bigcajones

Client
Регистрация
09.02.2011
Сообщения
1 216
Благодарностей
683
Баллы
113
I think this was already answered on Skype wasn't it? For those that want to know.

(?<=Queue</div>[\w\W]*<span\ class="count">)[\w\W]*?(?=</span>)
 
  • Спасибо
Реакции: s41mm3r

s41mm3r

Client
Регистрация
23.01.2013
Сообщения
47
Благодарностей
3
Баллы
8
aye, it was. Cheers buddy :-)
 

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