You are viewing limited content. For full access, please sign in.

Question

Question

String comparisons not case sentitive, but...

asked on November 29, 2016 Show version history

From my experience, workflow conditions are not case sensitive. How can the following condition:

return false if token %(Text) equals character a ? If not possible, what are the alternatives to implement case sensitive string comparisons into workflows ?

0 0

Answer

SELECTED ANSWER
replied on November 29, 2016

You can use the string function provided by Token Calculator to check whether 2 tokens are identical. The "exact" function will return "false" if the values are not identical, and "true" if they are. The check is case sensitive.

EXACT( %(Left), %(Right))

1 0

Replies

replied on November 29, 2016

Use regular expression as your condition. It's case sensitive by default.

0 0
replied on November 29, 2016

Problem is, regular expressions won't work if %(Text) contains 'reserved' characters such as parentheses:

0 0
replied on November 29, 2016

That's because reserved characters need to be escaped in order for regular expression to know they're supposed to be treated as literal values. The escape character is "\" and it needs to come right before the reserved character. So that would be A\( if you want to look for A(.

I looked into it a bit more though and it looks like we default conditions to be case insensitive for regular expressions as well. You can turn that off by adding (?-i) to the beginning of your regular expression. So (?-i)A\( for matching "A(" but not "a("

0 0
replied on November 29, 2016

I am aware of reserved regex characters as well as options (?i)/(?-i). However, it doesn't make sense to parse and escape strings prior to compare them through a pattern match. What are the alternatives ?

0 0
replied on November 29, 2016

I'm sorry, I don't understand the question. Regular expression syntax requires reserved characters to be escaped, so when you're writing the pattern in that top text box in your screenshot, you need to add the escape characters. The input value (which goes into the second box in the screenshot) does not need escape characters.

0 0
replied on November 29, 2016

Okay let me recap. I have 2 tokens (string values) - say %(Left) and %(Right) - that need to be compared for equality, case sensitive speaking. According to your second last answer, I would need to parse each character in %(Right) and insert an escape character "\" in front of each reserved character (found in %(Right)) prior to evaluate the condition:

0 0
replied on November 29, 2016

I can only work with what you're telling me, so I was trying to solve the problem you stated in original post. Please state the problem completely next time, trying to guess additional requirements just ends up wasting everybody's time.

0 0
SELECTED ANSWER
replied on November 29, 2016

You can use the string function provided by Token Calculator to check whether 2 tokens are identical. The "exact" function will return "false" if the values are not identical, and "true" if they are. The check is case sensitive.

EXACT( %(Left), %(Right))

1 0
replied on November 30, 2016

Thanks again Miruna for your precious assistance. I could effectiveley have stressed that the condition depicted in the original post was just an example.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.