Question & Answer
Question
When do you need to use double backslash to escape special character in regular expression using IBM® Rational® Robot?
Answer
When a string is double quoted, it is processed by the compiler and again at run-time. Since a backslash (\) is removed whenever the string is processed, the double-quoted string needs double backslashes so that there is one left in the string at run time to escape a "special character".
For Example:
We would like to extract ICRow0 using from a response where the pattern is as below:
|
"NAME=SEARCH_RESULT1 HREF=\"javascript: submitAction_main1\\(document.main1,'#([A-Za-z0-9]*)$0'\\)\" TABINDEX=28", sTemp3,&sRow);
where the right parenthesis and left parenthesis are the special characters that need to be escaped.
All source code and/or binaries attached to this document are referred to here as "the Program". IBM is not providing program services of any kind for the Program. IBM is providing the Program on an "AS IS" basis without warranty of any kind. IBM WILL NOT BE LIABLE FOR ANY ACTUAL, DIRECT, SPECIAL, INCIDENTAL, OR INDIRECT DAMAGES OR FOR ANY ECONOMIC CONSEQUENTIAL DAMAGES (INCLUDING LOST PROFITS OR SAVINGS), EVEN IF IBM, OR ITS RESELLER, HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. |
---|
Historical Number
133182735
Was this topic helpful?
Document Information
Modified date:
16 June 2018
UID
swg21152248