regexsearch Question

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

Parents Reply Children
  • 0
    Certified Lead Developer
    in reply to kirksain

    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: ""
    )
    this just returns "ball", since the regex pattern is not really regex.

    regexsearch(
      pattern: "\S*ball\S*",
      searchString: "some football games are fun",
      regexFlags: ""
    )
    This returns the word "football" (and would also return "basketball" or "ball" or "ballgames" for corresponding inputs) - basically any whole word with "ball" in it.

  • 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":

  • 0
    Certified Lead Developer
    in reply to kirksain
    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.

  • 0
    Certified Lead Developer
    in reply to kirksain

    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.