Question

I am working on Siebel CRM and using a regular expression in the eScript. The code is

var regexp2=/[ \t]{2,}/g;
var regexp4=/[ \n]{2,}/g;
var regexp6=/\r\n|\r|\n/g;
var regexp3=s/\r|\n/g;
temp = temp.replace(regexp2,' ').replace(regexp4,' ').replace(regexp6,'').replace(regexp3,'');

This code is replacing Tab and other characters which are written there in the code, but the issue is that the code is removing the new line if it comes at the end of the string, but if there is a new line between two strings, it is not working. i.e. the '\n' is not removed.

Second thing, if i am trying

select row_id,ADDR from siebel.S_ADDR_PER
where ADDR LIKE '%\n%'

It is not giving me any record, though, there are records if i am searching other way (without where condition).

Please Help.
Thanks in advance.

Was it helpful?

Solution

I have written something like this that works:

sOpStr = sOpStr.replace(/\n\r/g," "); //replace new lines with a blank.
sOpStr = sOpStr.replace(/\n/g," "); //replace new lines with a blank.
sOpStr = sOpStr.replace(/[\n\r]/g," "); //replace new lines with a blank.
sOpStr = sOpStr.replace(/[\n]/g," "); //replace new lines with a blank. `
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top