Appreciated Jean! It works as if miraculous. If you would accept a further 
challenge: how can the expression also find instances when only one of the 
attributes is present? bonus challenge: and if the attributes are not in 
that order?
Great big thanks

On Wednesday, August 25, 2021 at 4:53:49 PM UTC+3 jj wrote:

>
> Hi BBLuv,
>
> Find: 
>
>     <ANIMAL[^>]+NAME="([^"]*)"[^>]+LIKES="([^"]*)"[^>]*>
>
> Replace:
>
>     \1 -- \2
>
> and use the Extract button of the find window.
>
> HTH
>
> Jean Jourdain
>
> On Wednesday, August 25, 2021 at 2:12:48 PM UTC+2 BBLuv wrote:
>
>> Hi - non technical user here, proud to have figured out part of my goal.
>>
>> I have multiple XML files that I am trying to scan through to pluck out 
>> instances of tag attributes. The XML looks like this, and I want to extract 
>> the NAME and LIKES  attributes across the files. 
>>
>> <ANIMAL NAME="Fluffy" SPECIES="dog" LIKES="bones" AGE="6">
>>
>> Using grep + extract I am able to produce this:
>>
>> search = (?<=NAME=").*?(?=")|(?<=LIKES=").*?(?=")
>> output = 
>> Fluffy
>> bones
>> Tiger
>> chewtoys
>> Rusty
>> mailmen
>>             
>> I would love output that includes my own text:
>> Fluffy -- bones
>> Tiger -- chewtoys
>> Rusty -- mailmen
>>
>> or at least has the output values in one line per XML tag
>> Fluffy bones
>> Tiger chewtoys
>> Rusty mailmen
>>
>> I learned the pipe character lets me make multiple extractions but I am 
>> not able to control the output.
>>
>> Can you help?
>>
>> Thanking you...
>>
>>
>>
>>

-- 
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/089902e0-34e3-4d08-b2b0-5581e8b195a2n%40googlegroups.com.

Reply via email to