Skip to main content
Question

Trying to a SED like search and replace?

  • March 11, 2025
  • 17 replies
  • 75 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

Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

The Mask function is what I'd look at


  • Author
  • Employee
  • March 11, 2025

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.


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

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


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

Enable the g flag for global


  • Author
  • Employee
  • March 11, 2025

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

] there the output goes completely white :confused:


  • Author
  • Employee
  • March 11, 2025

with global set


  • Author
  • Employee
  • March 11, 2025

without global the first instance is replaced sucessfully


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

That is strange and shouldn't happen...


  • Author
  • Employee
  • March 11, 2025

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


  • Author
  • Employee
  • March 11, 2025

oh I know the problem


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

Try replacing it with € instead of space


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

Just to see how many it spits out


  • Author
  • Employee
  • March 11, 2025

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


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

Oh lol


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

You mean there were zero events :grin:


Forum|alt.badge.img
  • Participating Frequently
  • March 11, 2025

I assumed only _raw was empty afterwards


  • Author
  • Employee
  • March 11, 2025

yup all good now! thanks again!