Try this pattern:

(?s)>Artist</div>\s*<div 
class="field--item"><a[^>]+>(.*?)</a></div>.+?>Date of Birth</div>\s*<div 
class="field--item">(.*?)</div>.+?>Date</div>\s*<div 
class="field--item">(.*?)</div>

with this replacement:

\1 ~ \2 ~ \3
On Sunday, July 4, 2021 at 9:17:43 PM UTC+2 Kim Mosley wrote:

> I think I understand but I'm not sure how to translate that to my problem.
>
>
> *Here is a sample of the text:*
>
>   <div class="field field--name-field-collection-artist 
> field--type-entity-reference field--label-inline">
>   <div class="field--label">Artist</div>
>         <div class="field--item"><a 
> href="../../collection-artist/alfred-leslie.html" hreflang="en">Alfred 
> Leslie</a></div>
>       </div>
>
>   <div class="field field--name-field-artist-dob field--type-string 
> field--label-inline">
>   <div class="field--label">Date of Birth</div>
>         <div class="field--item">(b. 1927)</div>
>       </div>
>
>   <div class="field field--name-field-item-date field--type-string 
> field--label-inline">
>   <div class="field--label">Date</div>
>         <div class="field--item">1976</div>
>       </div>
>
>
> *The three grep patterns are:*
>
> (?<=Artist</div>
>         <div class="field--item">)(.*)(?=</a></div>)
>
> (?<=Date of Birth</div>
>         <div class="field--item">)(.*)(?=</div>)
>
> (?<=Date</div>
>         <div class="field--item">)(.*)(?=</div>)
>
> The current results are working well independently (the text in blue) - 
> but I'd like them to be returned in sequence (together) with a tilda 
> separating them:
>
> result A ~ result B ~ result C 
>
> On Jul 4, 2021, at 3:12 AM, jj <[email protected]> wrote:
>
> Hi Kim,
>
> If you could provide some sample text, grep patterns and expected results, 
> it would be easier to answer your question.
>
> Meanwhile this pattern may help:
>
> Find: 
> (?s)(?P<HEAD>first_pattern|second_pattern).*?(?P<TAIL>first_pattern|second_pattern)
> Replace: \P<HEAD>, \P<TAIL>
>
>
> Sample.txt
> --
> first_pattern bla bla bla second_pattern
>
> second_pattern foo
> bar first_pattern
>
> first_pattern foo bar fizz first_pattern
> --
>
> Extracted result:
> --
> first_pattern, second_pattern
> second_pattern, first_pattern
> first_pattern, first_pattern
> --
>
> HTH
>
> Jean Jourdain
>
> On Sunday, July 4, 2021 at 1:44:31 AM UTC+2 Kim Mosley wrote:
>
>> I have two greps that are working for extracting portions of multiple 
>> files. Can I combine the greps so the extraction pulls two phrases from the 
>> files and combines them as one extraction?
>>
>
> -- 
> This is the BBEdit Talk public discussion group. If you have a feature 
> request or need technical support, please email "[email protected]" 
> rather than posting here. Follow @bbedit on Twitter: <
> https://twitter.com/bbedit>
> --- 
> You received this message because you are subscribed to a topic in the 
> Google Groups "BBEdit Talk" group.
> To unsubscribe from this topic, visit 
> https://groups.google.com/d/topic/bbedit/wU9X1YEKMYc/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to 
> [email protected].
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/bbedit/0c59c775-c304-447a-ae79-0f3cb367fcd4n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/bbedit/0c59c775-c304-447a-ae79-0f3cb367fcd4n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
>
>

-- 
This is the BBEdit Talk public discussion group. If you have a feature request 
or need technical support, please email "[email protected]" 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/bbedit/61c89617-3576-4044-ba6f-3b110cdf9df5n%40googlegroups.com.

Reply via email to