Govinda <govinda.webdnat...@gmail.com> sez:

>> I need to do a grep search/replace:
>>
>> find:
>>    one string literal.. followed by any number of any chars...
>> followed by another string literal
>>
[...]
>..but why does the search pattern I mention in my orig. post fail?


The short answer :) is that  (\s|\S)*?  in the original pattern requires
the search to do too much work when applied against more than a small
amount of text.


The best way to match a multi-line `chunk of text` is:

(?s).+?     # or  ((?s).+?)  if you want to preserve the matched text

where the pre-pended (?s) allows . to match line breaks, and I suggest
keeping this in the top drawer of your grep toolbox. :-)


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc.                        <http://www.barebones.com>
P.O. Box 1048, Bedford, MA 01730-1048

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to