search for a string of letters, digits, punctuation and even html...

35 views
Skip to first unread message

Andy Nickless

unread,
May 10, 2023, 4:32:04 AM5/10/23
to BBEdit Talk
I'm just beginning to gently feel my way into grep at last, but I'm stumped here.
I want to isolate a string such as:
</span>The Cat that walked by himself:
I can't find how to include EVERY eventuality between </span> and the colon at the end.
I simply want to make whatever is between </span> and the colon, bold.
So it would look like this:
</span><strong>The Cat that walked by himself</strong>:
Can you help please?
Andy

Holger Bartel

unread,
May 10, 2023, 4:45:36 AM5/10/23
to BBEdit Talk
Hi, 

Try the following Find pattern with Grep turned on:

</span>(.+)\:

with this Replace pattern:

</span><strong>\1</strong>:

Hope this helps,
Holger



--
This is the BBEdit Talk public discussion group. If you have a feature request or need technical support, please email "sup...@barebones.com" rather than posting here. Follow @bbedit on Twitter: <https://twitter.com/bbedit>
---
You received this message because you are subscribed to the Google Groups "BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bbedit+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bbedit/dd5ddf44-0107-42a9-84a1-9019bfc79f43n%40googlegroups.com.

Kaveh Bazargan

unread,
May 10, 2023, 5:24:59 AM5/10/23
to bbe...@googlegroups.com
Minor comment:

The search string

</span>(.+)\:

will find the longest match as it is "greedy". I think you might need

</span>(.+?)\:

The "?" makes it non-greedy.

Regards
Kaveh



--
Kaveh Bazargan PhD
Director
Accelerating the Communication of Research
  https://rivervalley.io/gigabyte-wins-the-alpsp-scholarly-publishing-innovation-award-using-river-valleys-publishing-technology/

Andy Nickless

unread,
May 10, 2023, 6:44:45 AM5/10/23
to BBEdit Talk
My grateful thanks to Holger Bartel and Kaveh Bazargan for their swift responses!
Yes, the question mark makes a huge difference!
This is a big step forward for me and grep - I could quite easily get crazed with power (but I won't).
Thanks again for your help!

Kaveh Bazargan

unread,
May 10, 2023, 6:47:39 AM5/10/23
to bbe...@googlegroups.com
No problem Andy. Feel free to ping me directly if need be...

Reply all
Reply to author
Forward
0 new messages