LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Using StrFindI syntax - Unwanted matches

    Employee
    Posted 09-10-2018 23:12

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: I'mNewHere

    Hi Smart people

    I have a task involving matching the letters GM in a larger string of position title & having trouble wrapping my head around the syntax. This is my first coding language so apologies in advance if I need to ask for clarification.

    So far I'm using the following code (below) in my filter nodes to filter out matches such as "management" where GM appears mid string. This works ok, until the string finishes with the letters GM, which results in being also filtered with the undesirable records.

    I've been trying to figure out whether there's syntax for identifying records which finish with GM, like a wildcard that indicates the string stops after GM.

    I've also wondered whether I could search only the last 3 characters of the string for " GM" to prevent any false hits on records such as GMD, but haven't been able to understand the syntax to do so yet.

    positionTitle.strFindI("GM ") == -1
    Apologies if the question is overly basic, I'm still learning!


  • 2.  RE: Using StrFindI syntax - Unwanted matches

    Employee
    Posted 09-11-2018 05:30

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: stonysmith

    One easy way to search the righthand 3 characters is to use the right() function.

    positionTitle.right(3).strFindI("GM ") == -1
    For a more complicated, more capable search function, you could use Regular Expressions, but those can get very confusing fast.

    This will find any of the letters GM
    positionTitle.regexIsMatchI(".*GM*")
    Where this will find it only on the end of the string
    positionTitle.regexIsMatchI(".*GM")
    Regex expressions can get extremely sophisticated, but they're very terse, and therefore can be quite tough to read.
    For a full set of Regex documentation, consult www.pcre.org


  • 3.  RE: Using StrFindI syntax - Unwanted matches

    Employee
    Posted 09-11-2018 05:35

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: gmullin

    Just to add one more suggestion to Stony's regex examples this:

    positionTitle.regexIsMatchI(" GM")
    Should work for what you need. Basically anywhere with " GM" in the string (GM must be preceded by a white space) regardless of upper or lower case. If you want to look for only upper case GM then use regexIsMatch().


  • 4.  RE: Using StrFindI syntax - Unwanted matches

    Employee
    Posted 09-11-2018 16:24

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: I'mNewHere

    Thank you very much!

    I had been trying to figure out the syntax for left and right, but I had been trying to nest it with parentheses as you would in excel.

    RegismatchI is new, I'll have something new to learn about.

    I appreciate the help, thanks folks!