2011-09-03 11 views
0

내가이이 속성 :와일드 카드

나는 그것이 정규식에서 다음과 같이 어떤 색상을 선택해야 할
//th[@style='border-bottom-color: #ce9c00; text-align: left; line-height: 25px; 

;

//th[@style='border-bottom-color: #......; text-align: left; line-height: 25px; 

어떻게하면됩니까? 저는 C#과 Html Agility Pack을 사용하고 있습니다.

답변

1

사용 일치() XPath는 기능을 사용하고이 같은 정규 표현식을 제공 할 수 있습니다.

//th[matches(@salary,'^border-bottom-color: #[0-9a-fA-F]{6}; text-align: left; line-height: 25px$')] 

참고 : 색상 진수 진수 값을 사용하기 때문에 내가 준 [0-9A-Fa-f]와, 당신은 간단하게 사용할 수 있습니다 (점) 자리에 그합니다..

참조 : http://www.w3schools.com/xpath/xpath_functions.asp

0

당신은 등의 XPath 1.0 문자열 함수 substring, contains, 예컨대 :

//th[starts-with(@style, 'border-bottom-color: #') 
    and contains(@style, '; text-align: left; line-height: 25px;')]