I have tested the following regex using two different online tools:
\<(.*?)\>
In both they produce the same result, which is to match <any text within brackets>
including the brackets. This is what I want.
But in Sublime Text the result is different. It matches <any text within brackets
> only. Brackets are excluded.
Here's some sample text I've been testing on:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Text for testing regex -->
<data type="lorem">
<h3>Improving the lorem in your ipsum</h3>
</data>
<data type="image" number="1"/>
<data type="ipsum">
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.
</data>
Is this a bug with Sublime Text, or can the regex be modified to include the brackets in Sublime Text as well?
Thanks.
This,
(<.*?>)
might simply work OK then.
Curly brackets are metachars for capturing groups, which you just wanted to have your <>
in them so that your capturing group $1 would become (<.*?>)
, I guess.
jex.im visualizes regular expressions:
If you wish to simplify/modify/explore the expression, it's been explained on the top right panel of regex101.com. If you'd like, you can also watch in this link, how it would match against some sample inputs.