On Thu, 17 Oct 2024 03:14:21 -0700 (PDT), mrcmrc wrote:
> a Grep syntax to change a string of text 
> like this:
> 
> *House, Big Apple, Today, Movie*
> 
> into this:
> 
> *[[House]] | [[Big Apple]] | [[Today]] | [[Movie]]*

The regex below assumes

1. There are four word/phrase strings on each line.
2. Each such word/phrase string begins with a majuscule.
2. The first three such strings on each line are end
   delimited by a comma.
3. The fourth string is not so-delimited.

Given this

Search for
^\*([A-Z].*),\s([A-Z].*),\s([A-Z].*),\s([A-Z].*)\*

Replace with
\*\[\[\1\]\] | \[\[\2\]\] | \[\[\3\]\] | \[\[\4\]\]\*

When I use the above on this, slightly expanded and varied, example:

*House, Big Apple, Today, Movie*
*Word, Yesterday, Peter Piper, Film*
*Content Question, Overmorrow, Helena, Still Photograph*
 
It returns the following:

*[[House]] | [[Big Apple]] | [[Today]] | [[Movie]]*
*[[Word]] | [[Yesterday]] | [[Peter Piper]] | [[Film]]*
*[[Content Question]] | [[Overmorrow]] | [[Helena]] | [[Still 
Photograph]]*
 
Hope this helps.

Regards,

Brian Forte.
-- 
Brian Forte
<[email protected]>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or believe that the application isn't working correctly, please email 
"[email protected]" rather than posting here. Follow @bbedit on Mastodon: 
<https://mastodon.social/@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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/20241017213400937543.301eb262%40adelaide.on.net.

Reply via email to