# Xpath fb6

**URL:** https://www.finalbuilder.com/forums/t/xpath-fb6/1883
**Category:** Discussion
**Created:** [October 24, 2011, 5:28am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883 "2011-10-24T05:28:49Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![ranch](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ranch](https://www.finalbuilder.com/forums/u/ranch)
#### Post date: [October 24, 2011, 5:28am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/1 "2011-10-24T05:28:49Z")

</div>

Hi,

I'm having a problem itarating (with FB6) through a specific csproj file.

In the attached example I would like to get only the attributes that starts with the word TEST.

Cheers,

Ranch.

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)
#### Post date: [October 24, 2011, 11:56am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/2 "2011-10-24T11:56:32Z")

</div>

Hi Ranch

&nbsp;

I have attached a brief example that demonstrates how to do this. I had to modify you file a little as it was not valid xml.

&nbsp;

I have used the 'starts-with' function within the XPath string to select on nodes where the Include attribute starts with 'TEST'.

&nbsp;

Hope this helps.

&nbsp;

Regards,

Steve
[XpathExample.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/f/f716f075ef4c8ee219db1a8491d34813993276a2.zip) (2.496 KB)

---

<div class="post-metadata">

### Author: ![ranch](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ranch](https://www.finalbuilder.com/forums/u/ranch)
#### Post date: [October 25, 2011, 10:05am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/3 "2011-10-25T10:05:14Z")

</div>

Hi Steve,

Thank you, that helped a lot.

Just a fine tuning for my question: How can I get just the first value of the attribute (TEST.1234.ABCD)?

Cheers,

Ranch.

---

<div class="post-metadata">

### Author: ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)
#### Post date: [October 25, 2011, 11:50am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/4 "2011-10-25T11:50:13Z")

</div>

I have updated my example which now uses the Text Find action with a Regular Expression to extract the desired part of the attribute value into its own variable.

Hope this helps.

Regards,  
Steve

[xPathExampleUpdated.zip](https://www.finalbuilder.com/forums/uploads/default/original/2X/1/11769fb92e233788f92fb79053e535b1595a90f5.zip) (3.432 KB)

---

<div class="post-metadata">

### Author: ![ranch](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ranch](https://www.finalbuilder.com/forums/u/ranch)
#### Post date: [October 26, 2011, 10:30am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/5 "2011-10-26T10:30:55Z")

</div>

Hi Steve,

Thank you again for the quick and detailed response.

Cheers,

Ranch.

---

<div class="post-metadata">

### Author: ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)
#### Post date: [October 27, 2011, 2:42am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/6 "2011-10-27T02:42:26Z")

</div>

No problems, I forgot to mention in my previous post that the Regular Expression in the example is tailored to the sample values included in the file you provided. You may need to change the regex statement to be more dynamic for use in your actual build script.   
  
 Regards,   
 Steve

---

<div class="post-metadata">

### Author: ![ranch](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ranch](https://www.finalbuilder.com/forums/u/ranch)
#### Post date: [October 27, 2011, 9:15am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/7 "2011-10-27T09:15:58Z")

</div>

I noticed that, and made the needed adjustment.

btw - what should I write in the Regular Expression when part of the string in a combination of text and numbers?

exp':

TEST.ABCD.ABCD

TEST.ABCD.ABCD

TEST.ABCD1234

TEST.ABCD.ABCD

Just find the third string and ignoring the others?

Cheers,

Ranch.

---

<div class="post-metadata">

### Author: ![stephen.ryan](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/s/f14d63/32.png) [@stephen.ryan](https://www.finalbuilder.com/forums/u/stephen.ryan)
#### Post date: [October 27, 2011, 11:45am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/8 "2011-10-27T11:45:28Z")

</div>

If it is always going to be in this format you can use: TEST.[A-z]{4}[0-9]{4}   
  
 Here is the reference i use for Regular Expressions: [http://www.regular-expressions.info/](http://www.regular-expressions.info/)   
  
 Regards,   
 Steve

---

<div class="post-metadata">

### Author: ![ranch](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/r/bcef8e/32.png) [@ranch](https://www.finalbuilder.com/forums/u/ranch)
#### Post date: [October 30, 2011, 9:14am UTC](https://www.finalbuilder.com/forums/t/xpath-fb6/1883/9 "2011-10-30T09:14:44Z")

</div>

Thank you!

Cheers,

Ranch.
