Active Space "Like" Query does not return expected results.

Active Space "Like" Query does not return expected results.

book

Article ID: KB0089561

calendar_today

Updated On:

Products Versions
TIBCO ActiveMatrix BusinessWorks Plug-in for ActiveSpaces -
Not Applicable -

Description

Description:
Requirement: fetch data from Active Space which starts with the words which are provided on input. Implement this functionality using SNAP SHOT activity. 

We are using "Like" in our Query for e.g., RequestKey = "DAS_v1_0QQCCompanyName_v1_0_0|USA"  and CompanyName like 'TESTING ONLY\b'. What is returned are all records which contains "TESTING ONLY"  key word anywhere in the string. Our requirement is to fetch only those records which starts with "'TESTING ONLY". Why does the "Like" operator does not behave as expected? 

Issue/Introduction

Active Space "Like" Query does not return expected results.

Resolution

Query is a regular expression match.

http://regexlib.com/CheatSheet.aspx?AspxAutoDetectCookieSupport=1

^ indicates start of String

$ indicates end of String

For instance, if you want to start with TESTING ONLY, then use the filter

like "^TESTING ONLY.*"

Like is a regular expression. Doing the following will give any result containing TESTING ONLY\b.


CompanyName like 'TESTING ONLY\b' 

To test matches that start with TESTING ONLY\b, they would need to add ^ to the beginning of the text.

CompanyName like '^TESTING ONLY\b' ?

?This enforces the regular expression filter to match only if there is nothing before TESTING ONLY\b. ?

Here is more from wikipedia on regular expressions. 


POSIX basic and extended

??

In the POSIX standard, Basic Regular Syntax, BRE, requires that the metacharacters ( ) and { } be designated \(\) and \{\}, whereas Extended Regular Syntax, ERE, does not.

Metacharacter Description
.Matches any single character (many applications exclude newlines, and exactly which characters are considered newlines is flavor-, character-encoding-, and platform-specific, but it is safe to assume that the line feed character is included). Within POSIX bracket expressions, the dot character matches a literal dot. For example, a.c matches "abc", etc., but [a.c] matches only "a", ".", or "c".
[ ]A bracket expression. Matches a single character that is contained within the brackets. For example, [abc] matches "a", "b", or "c". [a-z] specifies a range which matches any lowercase letter from "a" to "z". These forms can be mixed: [abcx-z]matches "a", "b", "c", "x", "y", or "z", as does [a-cx-z].

The - character is treated as a literal character if it is the last or the first (after the ^, if present) character within the brackets: [abc-][-abc]. Note that backslash escapes are not allowed. The ] character can be included in a bracket expression if it is the first (after the ^) character: []abc].

[^ ]Matches a single character that is not contained within the brackets. For example, [^abc] matches any character other than "a", "b", or "c". [^a-z] matches any single character that is not a lowercase letter from "a" to "z". Likewise, literal characters and ranges can be mixed.
^Matches the starting position within the string. In line-based tools, it matches the starting position of any line.
$ Matches the ending position of the string or the position just before a string-ending newline. In line-based tools, it matches the ending position of any line.
( )Defines a marked subexpression. The string matched within the parentheses can be recalled later (see the next entry, \n). A marked subexpression is also called a block or capturing group. BRE mode requires \( \).
\nMatches what the nth marked subexpression matched, where n is a digit from 1 to 9. This construct is vaguely defined in the POSIX.2 standard. Some tools allow referencing more than nine capturing groups.
*Matches the preceding element zero or more times. For example, ab*c matches "ac", "abc", "abbbc", etc. [xyz]* matches "", "x", "y", "z", "zx", "zyx", "xyzzy", and so on. (ab)* matches "", "ab", "abab", "ababab", and so on.
{m,n}Matches the preceding element at least m and not more than n times. For example, a{3,5} matches only "aaa", "aaaa", and "aaaaa". This is not found in a few older instances of regular expressions. BRE mode requires \{m,n\}.



Additional Information