T
T
Testomal2020-06-05 02:25:51
Regular Expressions
Testomal, 2020-06-05 02:25:51

How to get a substring that has a question mark in it?

https://regex101.com/r/t0Q1W2/1

As you can see in the example, the expression looks for heading tags followed by a paragraph tag. But I want the expression to only find titles that have a question mark in them . Moreover, there may be spaces after the question mark, since the markup is not perfect.

Tried to pick it myself, nothing comes out.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
galaxy, 2020-06-05
@Testomal

(<h(?:3|4|5)[^<]*?\? *<\/h(?:3|4|5)>)((.*?\n)*?)(<p>.*?<\/p>)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question