You are viewing the documentation for Blueriq 15. Documentation for other versions is available in our documentation directory.
FIND
Looks for a string pattern within another string and returns the first matching characters. The function is case-sensitive.
Syntax
FIND ( pattern , string ) FIND ( pattern , string , startIndex )
Inputs
- pattern - An attribute of base type string or a string value. String must be a valid regular expression. The regular expressions used in several Blueriq Studio functions are common Java 1.4 expressions. For a complete documentation we refer to the online java documentation.
- string - An attribute of base type string or an expression that results in a string.
- startIndex - A positive integer value indicating at which character of the string the search should start (inclusive). This can be either an attribute of base type integer, an expression that results in an integer or a constant integer value. The first character starts at index 0.
Return type
- string
Examples
Entity.attribute | Value | Type |
---|---|---|
File.name | "Thisfile_1.doc" | String |
Expression | Result | Type |
---|---|---|
FIND ( "_[1-5]" , File.name ) | "_1" | String |
FIND ( "File" , File.name ) | UNKNOWN | String |
FIND ( "el" , "Hello" ) | "el" | String |
FIND ( "el" , "Hello" , 2 ) | UNKNOWN | String |
FIND ( "eo" , "Hello" ) | UNKNOWN | String |
FIND ( "\s[a-zA-Z]+" , "Hello world example" ) | "world" | String |
FIND ( "\s[a-zA-Z]+" , "Hello world example" , 6 ) | "example" | String |
Overview
Content Tools
4 Comments
Ronald Peterson
What is the character to use to escape a double quote (") within the pattern?
Ronald Peterson
I've used \x22 to represent " for other characters see https://en.wikipedia.org/wiki/ASCII
Unknown User (a.jansen)
Hi Ronald Peterson , noticed your comment, but saw that you already found an answer. A more concrete example for other readers: if you define a string attribute, for example Singleton.String with the constant value, including the double quotes "Test", FIND ("\x22", Singleton.String) will return a String value result with a double quote.
Unknown User (a.jansen)
Btw, you can also post questions to the community here: https://my.blueriq.com/questions