Search code examples
stringlualua-patterns

Stop matching after first occurence (single line)


How could I just match the first anchor tag and not all of them until the last one? Basically all of this: "<a...>...</a>" without the other ones? Would I need to sub the string before matching?

enter image description here

Here's what I got: https://regex101.com/r/hXh2JI/1

Thank you!


Solution

  • Try

    <a[^>]*>[^<]*</a>