I have a grid of data and need to search for specific activities associated with the record. I'm using regexSearch looking for terms like: football, baseball, basketball, golf, tennis, etc. The issue i'm seeing is that search terms "foot" and "football" find the relevant records. However, searching for "ball" returns nothing. Is there another unlisted flag or wildcard option that works with the function? The code below is what is currently active.
regexsearch( ri!searchBox_text, fv!item, "ig" )
Discussion posts and replies are publicly visible
In general I'd recommend starting out with a Regular Expression tutorial/guide - I found this one pretty helpful.
Thanks! I'm very familiar with regex, but the Appian functions do not blend well with regex patterns. I can't ask end users typing regex search patterns into the textbox.
Mind clarifying a bit as to what your use case is, then? I tried the regexsearch() function locally just now and found that it works as expected with regex pattern strings.
"search terms 'foot' and 'football'" from a list of user activities such as tennis, football, golf, basketball, etc. The result should be all records with activities with the relevant search term. Foot and Football returns records that have a football activity. ball returns nothing; it should return football, baseball, basketball, or volleyball.
If you're attempting to use user-input search terms, then my initial assumption is that you need to transform the user input into something that will work for a regex search pattern.
regexsearch( pattern: "ball", searchString: "football games are fun", regexFlags: "" )
regexsearch( pattern: "\S*ball\S*", searchString: "some football games are fun", regexFlags: "" )
Using the idea that I need to transform the textbox search string is still failing to return the proper results. If it's not really regex, why learn regex pattern syntax?
The textbox with results using "ball" and "foot":
kirksain said:If it's not really regex, why learn regex pattern syntax?
I was saying that about the search pattern "ball" -- it returns an exact match when there's an exact match found in the search string, but the string "ball" is not really regex as it's not actually using pattern matching. I wasn't talking about the function in general.
I'm a little unclear on how you're attempting to use this to search - are you trying to pair it with a query in some sense? Could you share a bit more of your code? I'm confused as to where the dataSubsets are coming from, as shown in your screenshot.
Using an online tester, this is the results i would expect to see using regex. "Ball" by itself should return the exact same results as "Foot" does for "Football".
If there is a list of 100 sports enthusiasts and 5 play football, I should return those 5 members searching for "Foot" or "Football". If 5 additional members play basketball and I search "ball", my result set would increase to 10 records, and so on.
Again, "Foot" a partial pattern returns the relevant records, "ball" does not.
Can you expand on what you mean by "returns the relevant records"? It sounds like you're referring to this working for query results, which is not what this function is intended to be used for.