SEARCH function: Difference between revisions

From Planfix
Jump to: navigation, search
 
No edit summary
Line 1: Line 1:
The SEARCH() function finds one text string within another and returns the starting position of the first text string relative to the first character of the second text string.
*The function is not case-sensitive.
*If the substring is not found, the function returns -1.
*If the empty string ("") is set as the argument for search_text, the SEARCH function will return 1.
*Wildcards can be used in the argument for search_text: question mark (?) and asterisk (*). Question marks match any character; asterisks match any sequence of characters. If you need to include a question mark or asterisk in the search text, put a tilde (~) before the symbol in the argument.
''Format:''
SEARCH(search_text;string)
SEARCH(search_text;string)
''Example:''
SEARCH("BOAT*down?he stream";"Row, row, row your boat, gently down the stream") //returns 20
SEARCH("What's up~?"; "Did he ask you what's up?") //returns 16
SEARCH("apple?";"one apple two apples") //returns 5
MID(<nowiki>{{Task.Field}}</nowiki>;Search(",";<nowiki>{{Task.Field}}</nowiki>)+2;1000) // returns Tom, if Task.Field="Hello, Tom"
== Go To ==
== Go To ==
*[[Standard functions | Standard operators and Planfix functions]]
*[[Standard functions | Standard operators and Planfix functions]]
*[[Calculated fields]]
*[[Calculated fields]]
*[[Reports]]
*[[Reports]]

Revision as of 02:11, 11 February 2021

The SEARCH() function finds one text string within another and returns the starting position of the first text string relative to the first character of the second text string.

  • The function is not case-sensitive.
  • If the substring is not found, the function returns -1.
  • If the empty string ("") is set as the argument for search_text, the SEARCH function will return 1.
  • Wildcards can be used in the argument for search_text: question mark (?) and asterisk (*). Question marks match any character; asterisks match any sequence of characters. If you need to include a question mark or asterisk in the search text, put a tilde (~) before the symbol in the argument.


Format:

SEARCH(search_text;string)

SEARCH(search_text;string)


Example:

SEARCH("BOAT*down?he stream";"Row, row, row your boat, gently down the stream") //returns 20

SEARCH("What's up~?"; "Did he ask you what's up?") //returns 16

SEARCH("apple?";"one apple two apples") //returns 5

MID({{Task.Field}};Search(",";{{Task.Field}})+2;1000) // returns Tom, if Task.Field="Hello, Tom"


Go To