INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Expressions: Most efficient way to do a logic "OR" with CONTAINS-like function?  (Read 1423 times)

Quixote

  • Regular Member
  • World Citizen
  • ***
  • Posts: 158
  • Change this by choosing profile

I'm wanting to do a check on lyrics for Explicit content. (I know I can also do this using a Search list, however, I need to do this as an expression.)

Questions:
  • What is the best practice way for searching a list of words/phrases in a tag?
  • Is MATH( | ) the appropriate way to do an "OR" in an expression?
  • Would a regular expression perform better or be more flexible?

What I've come up with so far is to identify "witch" and " ass " in Lyrics:

Code: [Select]
=If(Math(IsEqual([Lyrics],witch,8)|IsEqual([Lyrics],/ ass/ ,8))
    ,explict
    ,clean)

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732

Probably regex

ifelse(regex([lyrics]/#(witch|ass)/b)#/,0,0),explicit,clean)

Note: I'm learning regex so I've probably missed something, haven't tested...but you can extend the (1|2|3|...) ad infinite
Logged

mark_h

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1854

If you want to more deeply explore timing of operations you can turn on logging and create your expressions, then run each and check how long they take to run in the log... you can then choose the most optimal...
Logged
Pages: [1]   Go Up