reactjs – Regex For Finding Tag Boundary When Characters Are Contained Inside

I’m trying to create some regex that will match a react tag but I’m having difficulty because both / and > can be used inside the tag (i.e. for path or arrow function).

 updateFormat(params)}
 path="usr/path"
/>

I would like some regex that can select the entire component.

I tried something like this but I cannot figure out how to ignore either the / used in the path or the > used in the arrow function

])*\/>

I tried using negative capturing groups but that won’t let me select the entire component.

))*\/>

Read more here: Source link