0

I am trying to match a string with regex. Here are examples of how it should work

Should get content between center tags.

<center>match this text, can contain anything<\center>

Should get all of the content after the center tag

<center>match this text, can contain anything

I tried using look positive lookahead etc but I wasn't able to get it work

(<center>)(.*)(?=<\/center>)

for example, this regex doesn't match all of the content if the closing tag is not present. Any help would be so good. Thanks.

Wiktor Stribiżew
  • 607,720
  • 39
  • 448
  • 563
Sibyl
  • 134
  • 1
  • 8

0 Answers0