tags:

views:

31

answers:

1

I need to search for XML nodes whose names look like "image*", i.e. start with 'image'. My sample XML:

<a name="image.1">
  <b name="image.22" />
</a>

My XPath is /b[@name='image.22']. I want to write the seletion [@name='image.22'] in the form of using regular expression there. I've tried [@name='image.+'] but it doesn't work.

Please help.

+5  A: 

Use starts-with:

[starts-with(@name, 'image.')
Dewfy
Beat me to it :-)
Greg Beech
Thanks Dewfy. It works for me. But how about a more complex seletion using regular expression?
Nam Gi VU