2014-09-02 3 views
1

문자열과 정규식에서 매개 변수를 가져올 문자열이 있습니다.IsMatch 메서드는 거짓 일 때 거짓을 반환합니다.

내가 볼 수 없습니다 (할당량 및 대괄호 VS에서 그래서, 두 문자열이 런타임 동안 VS에서 복사)

{Data Flow Task:Error: There was an error with Insert Destination.Inputs[OLE DB Destination Input].Columns[(.*?)] on Insert Destination.Inputs[OLE DB Destination Input]. The column status returned was: "The value violated the integrity constraints for the column.".}

: 여기

"Data Flow Task:Error: There was an error with Insert Destination.Inputs[OLE DB Destination Input].Columns[EmissionMarket] on Insert Destination.Inputs[OLE DB Destination Input]. The column status returned was: \"The value violated the integrity constraints for the column.\"."

정규 표현식 것 : 여기에 메시지입니다 일치 할 수없는 모든 이유가 있지만 IsMatch 메서드는 false를 반환합니다. 내가 뭘 놓치고 있니?

+0

힌트 : 당신이 필요로하는 그 문자 중 일부를 벗어나기. – hwnd

+0

'[]'s를 이스케이프해야합니다. – PoweredByOrange

답변

1

"["및 "]"문자 때문입니다. 정규 표현식에서 이스케이프 처리해야합니다. 그렇지 않으면 문자 클래스로 간주됩니다. 즉이 필요합니다

Data Flow Task:Error: There was an error with Insert Destination.Inputs\[OLE DB Destination Input\].Columns\[(.*?)\] on Insert Destination.Inputs\[OLE DB Destination Input\]. The column status returned was: "The value violated the integrity constraints for the column.". 
1

정규 표현식은 문자 클래스를 형성하기 위해 []를 사용합니다. 적어도 [ 문자는 \[으로 탈출해야합니다. 또한 .의 모든 인스턴스를 이스케이프 처리해야합니다 (즉, 대신 \. 사용). 또는 해당 위치의 모든 문자를 일치시킬 수 있습니다.

자세한 내용은 Regular Expression Language - Quick Reference을 참조하십시오.

+0

감사합니다. – KorsaR

1

당신은 몇 가지 문자

모두 .[]이 샘플을 기반으로

\을 탈출 할 필요가있는 모든 문자를 정규식과 일반적으로 특별한 의미를 가진다 촉각 근해야하는 결과는 무엇인가있을 것입니다 같은 :

"Data Flow Task:Error: There was an error with Insert Destination\.Inputs\[OLE DB Destination Input\]\.Columns\[(.*?)\] on Insert Destination\.Inputs\[OLE DB Destination Input\]\. The column status returned was\: "The value violated the integrity constraints for the column\."\. 

Online Demo

관련 문제