Using StrFindI syntax - Unwanted matches
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.
Apologies if the question is overly basic, I'm still learning!
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
-
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
This will find any of the letters GM
positionTitle.regexIsMatchI(".*GM*")
positionTitle.regexIsMatchI(".*GM")
For a full set of Regex documentation, consult www.pcre.org -
Originally posted by: gmullin
Just to add one more suggestion to Stony's regex examples this:
positionTitle.regexIsMatchI(" GM")
-
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!
Please sign in to leave a comment.
Comments
3 comments