RegEx on server side scripts

dharani2607
Tera Contributor

Hello,

Need to write script in server side to replace / or \ with empty space.

I found below in community:

The SNC.Regex API is not available for scoped applications. For scoped applications, remove the SNC.Regex API and use standard JavaScript regular expressions.

We are using scoped applications, in that case how to achieve this?

 

Thanks

11 REPLIES 11

Aman Kumar S
Kilo Patron

if its simply removing / or \, why don't you use replace function in javascript:

CHeck out below link:

https://www.w3schools.com/jsref/jsref_replace.asp

 

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

Eg: File name is the field where it has the value as "test \ document / printed \ updated" this needs to be replaced as "test  document  printed  updated".

@dharani2607 

The example that I shared had everything

text.replace(/\//g" ");

 

Test by using background script:

var textStr= "test \ document / printed \ updated";
gs.info(textStr.replace(/\//g," "));

OP: 

test  document   printed  updated

Feel free to mark correct, If I answered your query.

Will be helpful for future visitors looking for similar questions 🙂

Best Regards
Aman Kumar

dharani2607
Tera Contributor

Eg: File name is the field where it has the value as "test \ document / printed \ updated" this needs to be replaced as "test  document  printed  updated".