-1

I have some text with the pattern

<i>[ <note>{text}</note>{more text} </i>.

I can find this pattern using

<i>\[ <note>.*</note>.*\] </i>

This works well unless there are more than one matches on a line (I am using BBEdit Grep searching if that helps). So if I have the following text:

This is the beginning of random text. <i>[ <note>i.e., </note>more information] </i>.  Another group of text <i>[ <note>i.e., </note>person] </i>continued 2nd text <i>[ <note>i.e., </note>third text] </i>more third text <i>[ <note>i.e., </note>Ending fourth text] </i>. Other information.

The search selects everything from the first < i> element to the last closing < /i> instead of the first closing < \i> element. How do I get it to stop at the first closing < \i> element?

ccampj
  • 665
  • 1
  • 8
  • 18

1 Answers1

-1

I was using greedy searching and I needed to use lazy searching. So my search pattern should be:

<i>\[ <note>.*?</note>.*?\] </i>

The addition of the two question marks will allow it to find each pattern on a line.

ccampj
  • 665
  • 1
  • 8
  • 18