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/49e6574a-009a-42e3-952a-97e66d281038n%40googlegroups.com.

Reply via email to