Searching a string



How can I search if a string is in another string.
Example variable ABC contains “it is a beautiful morning”
variable XYZ contains “beau”
Now I need to check if the content of XYZ exists in ABC contents


use contains in the condition builder


I knew it had to be something very easy. I kept looking into the String functions. This takes me to another simple question, since I’m new to Axure but I have been programming in C Lang for many years, is there a good Axure manual. A book that is more like a reference book rather than teaching how to program in Axure. If I have posted this question in the wrong place, please forgive me.
Thanks :slight_smile:


beside many tutorials provided by axure the is a website hosted by ezra schwartz. there are some advanced tutorials. ezra also wrote a book.

ritch macefield, one of the leading axure trainers and founder of axstream likes it and as far i can say its much more than essential.


Right on time,
I just realized my question about searching if a string is part of another is string. I can’t seem to find “contains” when I want to use it with Add Filter. You see in Add Filter, you set the Rule. In the Rule I want to say if the text in a cell in XYZ repeater is also in a cell of ABC repeater. But under Rule, you don’t have the option of “contains”

Let me elaborate more to clear the issue.
I want to Add Filter to XYZ
Rule = XYZ Column0 contains the text stored in repeater ABC column1
Example: Rule = “It is a beautiful morning” contains “tiful”
The option “contains” is not available where you set the Rule. But it is available where you set conditional statements


If a repeater data-cell contains a string, then that string will have an index within the repeater cell data. What you need to use is ‘.indexOf()’

Set your rule as [[LVAR1.indexOf(LVAR2) >= ‘0’]] Where LVAR1 is the data you are interrogating and LVAR2 is the string you’re looking for.


It magically works. :slight_smile:


Can ‘.indexOf()’ also be used, to then apply formatting - like BOLD - to just that string within the DATASET?


Yes, but it’s a little complex. Here’s a Set Text action I made to bold a matching text string from user input to another widget. Make sure to change the Set Text action from “Value” to “Rich Text” so you can apply to bold formatting. “This” in this case refers to the text field, so This.text is the text on the text field. This was used with a repeater data set so I’m comparing against column.

[[,]][b][[, + this.text.length)]][/b][[ + This.text.length,]]

In my use, if the text field has ‘abc’ on it and the repeater data set had ‘123abc456’ the output would be ‘123abc456’

Repeater autosuggest highlight search term in grouped lists

This is really interesting But i’m not quite getting it right. Could you take a look a the rp file? Basically i colour coded each line to figure out what it’s doing but honestly it’s a bit beyond me. Any help would be appreciated.
search and bold.rp (143 KB)


Hi norvillle,

As a first step, please see this thread on how to add a filter to a repeater. As repeaters and using math functions are advanced features of Axure RP, I’d encourage you to go through our training materials on the subject to get a good general sense of when and how to use them:

Repeaters Widgets

Math, Functions, and Expressions

And here are the edits I made to your file:

  1. Rather than having the “Set Text” action on the repeater’s OnItemLoad, you’ll want it on the OnTextChange of “input1” so that the searched term highlights (bolds) as you type.

  2. On input1’s OnTextChange, you’re going to first add a filter that checks for the typed text in the text field to the “Body” column of the repeater:

[[Item.Body.toLowerCase().indexOf(LVAR1.toLowerCase()) >= 0]]

where Item.Body is the Body column of your “search results repeater” and LVAR1 is the “input1” text field. I also included .toLowerCase so there isn’t case sensitivity for the searched term.

  1. Add a “Set Text” action (rich text) with Nathan’s code from above:
[[Item.Body.substring(0, Item.Body.toLowerCase().indexOf(LVAR1.text.toLowerCase()))]][b][[Item.Body.substring(Item.Body.toLowerCase().indexOf(LVAR1.text.toLowerCase()), Item.Body.toLowerCase().indexOf(LVAR1.text.toLowerCase()) + LVAR1.text.length)]][/b][[Item.Body.substring(Item.Body.toLowerCase().indexOf(LVAR1.text.toLowerCase()) + LVAR1.text.length, Item.Body.length)]]

where Item.Body is the Body column of your “search results repeater” and LVAR1 is the “input1” text field.

  1. Add a condition that checks for the length of the typed value for Case 1:
If length of value widget This is greater than "1"

where This is the input1 text field.

  1. Lastly, add another conditional case (Case 2) with “Else if” to remove all filters when the input1 text field is blank/cleared.

What this is doing is removing any filters that the repeater had (from Case 1) when the user clears the text field. When the user types into the text field again, then the repeater will get filtered to the typed text of the text field, and then that matching text will get bolded.

I hope this helps!
search and bold_EDIT.rp (147 KB)



Sorry for bringing this thread out of the dead but it seems to be the most relevant to my question (and I used the information here as the basis for my wireframe)

I understood how to make the search string to become highlighted, but I have encountered the following issue: I am trying to use this on a grid with several columns. The filter works fine, and on the cells that actually contain the search string, it is correctly highlighted. The problem is that on the other cells, that should not be highlighted, there’s a strange behavior - the last character is being duplicated to the beginning and appears highlighted too. I guess this is because of how the “Set text” is defined but I have no idea how to make the text change only for the relevant cells. Anyone?

Here’s a link to the wireframes:
Here’s the file: Search on grid.rp (2.2 MB)

Many thanks in advance,



I know it’s been ages, but I don’t suppose you were able to resolve this were you?



Hi @Neill ,

Actually, I was able to figure it out - see this demo:

I am attaching here the file with the working example - I solved it quite a while ago, so I don’t exactly recall what I did… But if you look at the actions defined on the repeater, you should be able to take it from there.

File: Search on grid.rp (634.0 KB)



Wow that’s great.

Quite an in depth solution. Impressive.