Searching for an asterisk (*)

Vaughn
Vaughn Altair Community Member
edited April 2023 in Community Q&A

I am using classic. I know the * is a wildcard, however, I want to search for a * in my data. How can I search for it and have it not use it as a wildcard? 

[Field1] = "*" will search for everything. I want it to only find the rows that just have a * in it. Hopefully that makes sense. 

Best Answer

  • Lasse
    Lasse Altair Community Member
    edited April 2023 Answer ✓

    Hello Vaughn,

    RegexIsMatch function is one option for Expression Search: RegexIsMatch([Field1];"\*")

    -Lasse

Answers

  • Lasse
    Lasse Altair Community Member
    edited April 2023 Answer ✓

    Hello Vaughn,

    RegexIsMatch function is one option for Expression Search: RegexIsMatch([Field1];"\*")

    -Lasse

  • Nicholas_21406
    Nicholas_21406
    Altair Employee
    edited April 2023

    Hi Vaughn,

    If you use a Standard Trap, asterisks are not considered special characters.  You would have to know in which column you expected to find the asterisk, though, and you would have to specify exactly what columns you wanted to capture in your matching line (note that *.sas7bdat is just the text found in the document, it is not part of the trap):

    image

     

    With a Regular Expression (Regex) trap, asterisks are considered special characters, but you could just put a backslash in front of the asterisk - in this case, you no longer need to know which column in which the asterisk is found, and you can specify, for example, that you wanted to capture the asterisk plus the dot that followed the asterisk (dot is also a special character in Regex so must also be escaped), and then the rest of the characters until the end of the word.

    image

    I'm afraid a complete description of Regular expressions in general and trapping in Monarch is beyond the scope of this post, but here are a reference:

    https://help.altair.com/monarch/current/help/desktop/Creating_a_Regex_Trap.htm

    I would suggest you to  sign up for on boarding training, which was probably included in your purchase and/or open a Support ticket - attaching any document you are working with and the model file associated with any work you have completed so far.

  • CPorthouse
    CPorthouse
    Altair Employee
    edited April 2023

    You can also use the instr() function.  If the * character is in your string it will return a number greater than 0

    instr("*",[field 1])