Reputation: 145
I have this:
//th[@style='border-bottom-color: #ce9c00; text-align: left; line-height: 25px;
I want to make it select any color, like this in regex;
//th[@style='border-bottom-color: #......; text-align: left; line-height: 25px;
How do I do this? I'm using C# and Html Agility Pack.
Upvotes: 0
Views: 238
Reputation: 2436
use matches() xpath function and give it a regular expression like this.
//th[matches(@salary,'^border-bottom-color: #[0-9a-fA-F]{6}; text-align: left; line-height: 25px$')]
Note: I have given [0-9a-fA-F] because color takes hex decimal value, you can simply use .(dot) in place if that.
Reference: http://www.w3schools.com/xpath/xpath_functions.asp
Upvotes: 1
Reputation: 56162
You can use XPath 1.0 string functions substring
, contains
, etc, e.g.:
//th[starts-with(@style, 'border-bottom-color: #')
and contains(@style, '; text-align: left; line-height: 25px;')]
Upvotes: 0