Skip to main content
Question

Trying to a SED like search and replace?

  • Mar 11, 2025 3:17 AM UTC
  • 17 replies
  • 236 views

[SOLVED] Hello, I have a few events which contain a raw field with multiple [
]'s. I'd like to replace all occurances with " ". I tried in a Eval function: _raw=_raw.replace(/[

]+/, " "). This works for the first occurance, but not the others. I also tried with replaceAll, but that just crossed out the entire field. Is there a simple way to just do a SED like search and replace?

17 replies

xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

The Mask function is what I'd look at


Hi, thank you. I just tried Mask, but I don't see a way to make it match all instances for the carriage return. It again just replaces the first.


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

In the Regex field, there are flags on the right side


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

Enable the g flag for global


ah very nice thank you. This works perfectly for literal strings. But when I put [

] there the output goes completely white :confused:


with global set


without global the first instance is replaced sucessfully


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

That is strange and shouldn't happen...


just to be sure I copied the raw event in notepad++ to verify the carriage returns; they're there. hmm


oh I know the problem


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

Try replacing it with € instead of space


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

Just to see how many it spits out


one should remove the filter with which one identtifeid the multiple carriage retunrs :smile: with the filter gone, it works perfectly! thanks again


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

Oh lol


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

You mean there were zero events :grin:


xpac
Forum|alt.badge.img
  • Inspiring
  • Mar 11, 2025 4:13 AM UTC

I assumed only _raw was empty afterwards


yup all good now! thanks again!