Regex - nesting

lukaszp150

Новичок
Регистрация
21.09.2017
Сообщения
2
Благодарностей
0
Баллы
1
Hey
I would like to find "Dermatologia i wenerologia" using a regular expression. The problem with this is that there are several classes with the same name. Example:

HTML:
<div class="media-body">
                    <p class="mb-0-5">
                <span class="d-flex flex-wrap align-items-center">
                        Leczone choroby

                                    </span>
            </p>
        
                        <ul class="text-muted pl-2">
                                    <li>
                    
Trądzik młodzieńczy                </li>
</ul>

                                        </div>

    <div class="media-body">
                    <p class="mb-0-5">
                <span class="d-flex flex-wrap align-items-center">
                                            <span>Specjalizacje</span>
                    
                                    </span>
            </p>
        
                        <ul class="text-muted pl-2">
                                    <li>Dermatologia i wenerologia</li>
                        </ul>
        
                                                            </div>
</div>
The footprint in the example is "Specjalizacje".
 

lokiys

Moderator
Регистрация
01.02.2012
Сообщения
4 799
Благодарностей
1 187
Баллы
113
Hi, regex first chunk with your footprint. = Specjalizacje[\w\W]*?</li>
Then take regexed data and push through another regex. = (?<=<li>).*?(?=</li>)
Done
 

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