Write a GREL to remove CRLF?

Hi there,

New to OR and no experience with this kind of work! I am trying to write a GREL expression to remove any carriage returns or new lines. I have tried a few different combinations, but there are still some records that have weird spacing. These are the GREL expressions that I have tried:

  1. value.replace (/\n/, " ")
  2. value.replace(/\r/, " ")

When I copied text into Notepad++ to see if I could find out some more information, I could see (just using the letter a to represent the text here)

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.CRLF

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.CRLF

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaCRLF

Can someone help me to write a GREL to remove the CRLF? We want the text to be one full paragraph without any hard returns or new lines.

Thanks so much!!

If it's really literally just a CRLF pair, then the GREL expression value.replace(/\r\n/, ' ') should do the trick, but you might want to consider making it more general such as value.replace(/[/r/n ]+/,' ') which would replace any string of carriage returns, line feeds, and spaces, in any order, with a single space.

If you want an easy way to test with your actual data, there are a number of regex testers floating around on the Internet. Be sure to select the "Java" flavor since all regex implementations differ slightly.

p.s. if you need to deal with any Unicode whitespace character, you could use something like (?U)\s