On Fri, Oct 31, 2008 at 09:12:09PM -0700, Govinda wrote: > Not that this is a practical issue now, but still: isn't it odd that > the way I had it before it matched one thing when using 'command-G', > and another when using 'command-shift-G'?! Shouldn't it match the > same thing regardless of which direction we are searching?
The current behavior does make sense, actually, when you think about how BBEdit does the search. Pattern: (<td.*?>)(.+)(</td>) Text: <table><tr><td>foo</td><td>bar</td></tr></table> First, consider searching forward, starting from the beginning of the line. The regex engine steps forward one character at a time, until it gets to the first <td>, which is matched by <td.*?>. The next part of the pattern is .+, which should match as many characters as possible. The regex engine starts by matching .+ all the way to the end of the line, then backtracks one character at a time until it gets to the second </td>, which is matched by (</td>). Then consider searching backward, starting from the end of the line. The regex engine steps backward one character at a time, until it gets to the second <td>, which is matched by <td.*?>. Once again, the regex engine matches .+ all the way to the end of the line, then, as before, backtracks one character at a time until it gets to the second </td>, which is matched by (</td>). The .+ allows the pattern to match across </td><td> to the last </td> on the line, so you get a different result if you start at the beginning of the line versus at the end. Ronald --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "BBEdit Talk" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/bbedit?hl=en If you have a specific feature request or would like to report a suspected (or confirmed) problem with the software, please email to "[EMAIL PROTECTED]" rather than posting to the group. -~----------~----~----~----~------~----~------~--~---
