Subscribe Bookmark RSS Feed

JSL Regex - matching anything except word


Community Member


Feb 6, 2013

Hi there,

I am having trouble forming a regex expression (in JMP 9) that will match any word except some words that are specified.

So for instance,

Say, I dont want to match "hello" or "goodbye", but everything else.

A search online suggests


but JSL doesn't seem to support this type of regular expression.

I don't want to use any outside functions to help in this process, I just want to use a regular expression to accomplish this task because it will be used within another regular expression that is more complex. Could anybody help me with this problem?




Community Manager


Jun 23, 2011

I don't do Regex but, depending on exactly what you want, the JSL functions Contains() and Substitute() can get you there.

str1="You say goodbye and I say hello, hello, hello.";

str2 = "I don't know why you say goodbye, I say hello, hello, hello.";

show((contains(str1, "Hello")) | contains(str1, "Goodbye"));

str3=substitute(substitute(str2, "hello", ""), "goodbye", "");



Contains(str1, "hello") | Contains(str1, "goodbye") = 1;

"I don't know why you say , I say , , ."