Returns the index value in the input string where the last instance of a matching string is located. Search is conducted right-to-left.

Input can be specified as a column reference or a string literal, although string literal usage is rare.

You can also search a string from the left. For more information, see FIND Function.

Column reference example:

rightfind(MyName,'find this',true,0)

Output: Searches the MyName column value for the last instance of the string find this from the end of the value, ignoring case. If a match is found, the index value from the beginning of the string is returned.

String literal example:

rightfind('Hello, World','lo',false,2)

Output: Searches the string Hello, World for the string lo, in a case-sensitive search from the third-to-last character of the string. Since the match is found at the fourth character from the left, the value 3 is returned.

If example:

if(rightfind(SearchPool,'FindIt') >= 0, 'found it', '')

Output: Searches the SearchPool column value for the string FindIt from the end of the value (default). Default behavior is to not ignore case. If the string is found, the value found it is returned. Otherwise, the value is empty.

rightfind(string_to_search,search_for,[ignore_case], [start_at])


ArgumentRequired?Data TypeDescription
string_to_searchYstringName of the string, function returning a string, or a column containing strings.
search_forYstring

The string or pattern you want to search. This can be a string, function returning a string, or string literal or

Pattern pattern or regular expression.
ignore_caseNbooleanIndicates if the Rightfind function ignores case when trying to match the string or pattern. The default value is false.
start_atNinteger (non-negative)

Indicates the position in the column or string literal value at which to begin the search. This value can be an integer, a function returning an integer, or a column containing integers. The default value is 0.

If not specified, the entire string is searched.

string_to_search

Name of the item to be searched. Valid values can be:

Missing values generate the start-index parameter value.

 

Required?Data TypeExample Value
YesString literal or column reference (String, Array, or Object)myColumn

search_for

String literal or pattern to find. This value can be a string literal, a , or a regular expression.

Required?Data TypeExample Value
YesString literal or pattern'Hello'

ignore_case

If true, the RIGHTFIND function ignores case when trying to match the string literal or pattern value.

Default value is false, which means that case-sensitive matching is performed by default.

Required?Data TypeExample Value
NoBooleantrue

start_at

The index of the character in the column or string literal value at which to begin the search, from the end of the string. For example, a value of 2 instructs the RIGHTFIND function to begin searching from the third character in the column or string value.

NOTE: Index values begin at 0. If not specified, the default value is 0, which searches the entire string from the end of the string.

Required?Data TypeExample Value
NoInteger (non-negative)2

Example - Locate filenames in a URL

In this example, you must extract filenames from a column of URL values. Some rows do not have filenames, and there is some variation in the structure of the URLs.

Source:

URL
www.example.com
http://www.example.com
http://www.example.com/test_app
http://www.example.com/index.html
http://www.example.com/resources/mypic.jpg
http://www.example.com/pages/mypage.html
http://www.example.com/resources/styles.css
www.example.com/resources/styles.css

Transformation:

To preserve the original column, you can use the following to create a working version of the source:

You can use the following to standardize the formatting of the working column:

Tip: You may need to modify the above to use a to also remove https://.

The next two steps calculate where in the filename values the forward slash and dot values are located, if at all:

If either of the above values is 0, then there is no filename present:

 

Results:

After removing the intermediate columns, you should end up with something like the following:

URLfilename
www.example.com 
http://www.example.com  
http://www.example.com/test_app  
http://www.example.com/index.html index.html
http://www.example.com/resources/mypic.jpg mypic.jpg
http://www.example.com/pages/mypage.html mypage.html
http://www.example.com/resources/styles.css styles.css
www.example.com/resources/styles.cssstyles.css