-2

I'm trying to find a way to make a list of everything between <right>and </> tags
This is my regex:

<right>([^<\/>]*)<\/>? 

I'm currently missing this case:

  • when there is only 1 tag in front: <right>hi
  • when interlocked <right><right>hello</></> (for the case of nesting, the content inside will be viewed as text, the next card is processed as usual)

it will look like this:

case1:
<div style="text-align: right">
  hi
</>

case2:
<div style="text-align: right">
   <div style="text-align: right">
     hello
   </>
</>

This is where i try regex: https://regex101.com/r/ybO9cV/1
thanks for your help !

Duc Vo
  • 1
  • 1

1 Answers1

0

Mostly bad news. To get the matches that are missing the trailing </> use /<right>([^<\/>]*)(<\/>)?/g

The nesting requirement cannot be satisfied with regex - can-regular-expressions-be-used-to-match-nested-patterns

John Williams
  • 4,252
  • 2
  • 9
  • 18