-3

I have got a string with links (as a-elements inside a unordered list (<li>), in HTML). How can I use the correct regular expression to parse it?

I need to get the array of this values:

[
    "Керамическая плитка", 
    "Напольные покрытия"
]

Base HTML (example):

<li><a href="/plitka/">Керамическая плитка</a></li> 
<li><a href="/napolnye-pokrytiya/">Напольные покрытия</a></li> 
<li><a href="/oboi/">Обои</a></li> 
<li><a href="/mebel-dlia-vannoi/">Мебель для ванной</a></li> 
<li><a href="/santehnika/">Сантехника</a></li>

Thank you very much. Really appreciate your help!

jankal
  • 1,090
  • 1
  • 11
  • 28
  • 1
    Welcome to Stack Overflow. Please read up on how to provide a [Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) You may also benefit from [How to ask](https://stackoverflow.com/help/how-to-ask) and [What is expected of SO users](https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users) – mtr.web Mar 18 '19 at 17:55
  • 1
    Hi, welcome to Stack Overflow. Could you edit your question to clarify it a bit please. Please include your relevant PHP code, and clarify (if the code doesn't) exactly what you are parsing. Also please either explain why css is relevant or remove that tag. Thanks. – MandyShaw Mar 18 '19 at 17:58
  • 1
    Are you trying to get the value of each `` tag? For example, 'parsing' `
  • Керамическая плитка
  • ` would give you `Керамическая плитка`? – mtr.web Mar 18 '19 at 17:58
  • Parse them for what? You need to be explicit when it comes to what you're actually asking about. – M. Eriksson Mar 18 '19 at 18:00
  • Thanks for answers. I need to get the arrey of this values: Керамическая плитка Напольные покрытия ... – Stephan Golubev Mar 18 '19 at 18:02
  • 4
    Just a note. If you need to parse HTML, [you shouldn't use regular expressions](https://stackoverflow.com/a/1732454/2453432). Use something like [DOMDocument](http://php.net/manual/en/class.domdocument.php) instead. – M. Eriksson Mar 18 '19 at 18:04