cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
New to using JMP? Hit the ground running with the Early User Edition of Discovery Summit. Register now, free of charge.
Register for our Discovery Summit 2024 conference, Oct. 21-24, where you’ll learn, connect, and be inspired.
Choose Language Hide Translation Bar
dadawasozo
Level IV

remove different pattern of strings from log in one formula

Hi

 

I want to remove few patterns of string from log.

example of log:
[01/19/23 04:06:37 PM] [INFO ] [text.text:__text__:<text>():280]: [ 25.053966] text: text text text:

[ 19.620450] text_text 0000:42: text 2 [text text text 0x2045ffff] 0x0aa00100f

Patterns I want to remove or replace with "":

1) all special characters

2) date and time

3) any hex or strange address number like x2045ffff or 0x0aa00100f

 

the way I'm doing now is using substitute or regex to remove one type by one type (1-3), so I have 3 columns created. is it possible to combine all in one formula (one column)?

1 ACCEPTED SOLUTION

Accepted Solutions
jthi
Super User

Re: remove different pattern of strings from log in one formula

If you have working solution, you can combine all of those into single formula by chaining those expressions. 

Substitute(Regex(Substitute(str, "!", "")," ", "", GLOBALREPLACE), "123", "");

or using variables 

str1 = Substitute(str, "!", "");
str1 = Regex(str1, " ", "", GLOBALREPLACE);
Substitute(str1, "123", "");

I also attached data table with the formulas

-Jarmo

View solution in original post

1 REPLY 1
jthi
Super User

Re: remove different pattern of strings from log in one formula

If you have working solution, you can combine all of those into single formula by chaining those expressions. 

Substitute(Regex(Substitute(str, "!", "")," ", "", GLOBALREPLACE), "123", "");

or using variables 

str1 = Substitute(str, "!", "");
str1 = Regex(str1, " ", "", GLOBALREPLACE);
Substitute(str1, "123", "");

I also attached data table with the formulas

-Jarmo